Hi all,
I have a program that I have to write with an output that looks like this:
----------------------------------------------------------
Wages for 3 employees
For 10 hours worked, the wages are 120 dollars
For 20 hours worked, the wages are 240 dollars
For 30 hours worked, the wages are 360 dollars
For 40 hours worked, the wages are 480 dollars
Wages for 4 employees
For 10 hours worked, the wages are 160 dollars
For 20 hours worked, the wages are 320 dollars
For 30 hours worked, the wages are 480 dollars
For 40 hours worked, the wages are 640 dollars
Wages for 5 employees
For 10 hours worked, the wages are 200 dollars
For 20 hours worked, the wages are 400 dollars
For 30 hours worked, the wages are 600 dollars
For 40 hours worked, the wages are 800 dollars
Wages for 6 employees
For 10 hours worked, the wages are 240 dollars
For 20 hours worked, the wages are 480 dollars
For 30 hours worked, the wages are 720 dollars
For 40 hours worked, the wages are 960 dollars
-------------------------------------------------------
my program however only outputs:
------------------------------------------------------
Wages for 3 employees
For 10 hours worked, the wages are 120 dollars
For 20 hours worked, the wages are 240 dollars
For 30 hours worked, the wages are 360 dollars
For 40 hours worked, the wages are 480 dollars
Wages for 4 employees
Wages for 5 employees
Wages for 6 employees
---------------------------------------------------------
How do I fix this?
Heres the code:
import java.util.Scanner;
import java.io.*;
public class prog166d2
{
public static void main (String[] args)
{
int hours = 10;
int wage = 4;
int emp = 3;
int maxemp = 6; //maximum number of employees
int count = 0;
int counter = hours * wage;
while(count <= (maxemp-emp)){
while(emp <=maxemp)
{
System.out.println("\nWages for " +emp +" employees\n");
while(hours<= counter)
{
int calc = hours * wage * emp;
System.out.println("For " +hours +" hours worked, the wages are " +calc +" dollars");
hours +=10;
}
while(hours ==counter)
{hours = 10;}
emp += 1;}
count +=1;
}
}
}
Thanks!