the application below is what i did so far, please give me feedback
the Payroll Program so that it uses a class to store and retrieve the employee's name, the hourly rate, and the number of hours worked. Use a constructor to initialize the employee information, and a method within that class to calculate the weekly pay. Once stop is entered as the employee name, the application should terminate.
import java.util.Scanner; // program uses class Scanner
public class PayrollProgramPart2 //start class PayrollProgramPart2
{
// start method main
public static void main( String args[] )
{
Scanner input = new Scanner( System.in ); //create Scanner to obtain input from CMD
//input commands
System.out.print( "Please enter employee's name: "); //prompt for employee's name
String name = input.nextLine(); //input employee's name
do //do statement for loop
{
//input hourly rate
System.out.print( "Please enter hourly rate: $"); // prompt for hourly rate
double rate = input.nextFloat(); //input hourly rate
while (rate <= 0) //check and loop for equal to or less than 0
{
System.out.print( "Please enter positive hourly rate: $"); //prompt for positve rate
rate = input.nextFloat(); //input hourly rate
} //end while
//input number of hours worked
System.out.print( "Please enter number of hours worked:" );
// prompt for hours worked
double hours = input.nextFloat(); //input hours worked
while (hours <= 0) //check and loop for equal to or less than 0
{
System.out.print( "Please enter positive number of hours: ");
//prompt for positve hours
hours = input.nextFloat(); //input hours worked
} //end while
//calculation commands
double pay = hours*rate; // multiple hours x rate = pay
//output commands
System.out.printf(name +"'s pay this week is: $%.2f\n", pay);
// display employee's name and pay
name = input.nextLine();
System.out.print( "Please enter employee's name or stop to quit: ");
// prompt for employee's name
name = input.nextLine(); //input employee's name or stop
}while (!name.toLowerCase().equals("stop"));
//while statement for loop until name = stop
System.out.print( "Program Terminated" ); // end message
}
// end method main
} // end class PayrollProgramPart2