ShadowX
ShadowX
CC#
Created by ShadowX on 2/1/2023 in #help
❔ pls help
well im trying to figure out how to receive as an input a large number of workers in void main. can someone help?
using System;
public class Program
{
public class Worker
{
private int id;
private bool senior;
private int numHours;
public Worker(int id, int years)
{
this.numHours = 0;
if (years > 5)
{
this.senior = true;
}
else
this.senior = false;
}
public int Salary()
{
if (this.senior == true)
return (55 * this.numHours);
else
return (45 * this.numHours);
}
public void print()
{
if (this.senior == true)
Console.WriteLine("monyanyo"+55*this.numHours);
else
Console.WriteLine("monyanyo"+45*this.numHours);
}
}
public static void Main(string[] args)
{

}
}
using System;
public class Program
{
public class Worker
{
private int id;
private bool senior;
private int numHours;
public Worker(int id, int years)
{
this.numHours = 0;
if (years > 5)
{
this.senior = true;
}
else
this.senior = false;
}
public int Salary()
{
if (this.senior == true)
return (55 * this.numHours);
else
return (45 * this.numHours);
}
public void print()
{
if (this.senior == true)
Console.WriteLine("monyanyo"+55*this.numHours);
else
Console.WriteLine("monyanyo"+45*this.numHours);
}
}
public static void Main(string[] args)
{

}
}
9 replies