need help to identify error listed

February 19, 2011 at 10:06:50
Specs: Windows 7
can not find symbol in the rate = input.nextdouble() ; // read hourly rate again


// payroll part 2 payroll2.java
// Calculate weekly pay for an employee
// Displays employee name and calculated weekly pay

import java.util.Scanner;


public class payroll2
{
// Main method begins execution of Java application
public static void main( String args[] )
{
while (true)
{

// Scanner enables a program to read data input by user
Scanner input = new Scanner( System.in );

// Ask user for name
System.out.println( "Enter employee name to continue or enter 'stop' to end:" ); // prompt for name
String Name = input.nextLine(); // read name from user
System.out.println();

//Ask user for hourly rate
System.out.println( "Enter hourly rate:" ); // prompt for hourly rate
Double rate = input.nextDouble(); // read rate from user
System.out.println();
if(Name.equalsIgnoreCase("stop"))

{
System.out.println( "good bye. "); // end payroll2 program
System.out.println();
System.exit(0);

}


//Ask user for hourly rate
System.out.println( "Enter hourly rate:" ); // prompt for hourly rate
Double Rate = input.nextDouble(); // read rate from user
System.out.println();

while (rate <= 0) // prompt until a positive value is entered (loop)

{

System.out.print( "enter a positive value. " +
"Please enter hourly rate again: " ); // prompt for positive value for hourly rate
Rate = input.nextdouble(); // read hourly rate again
System.out.println();

}

//Ask user for number of hours worked
System.out.println( "Enter number of hours worked this week:" );
Double Hours = input.nextDouble(); // read hours worked from user
System.out.println();

while (Hours <= 0) // prompt until a positive value is entered (loop)

{

System.out.print( "Hours worked must be a positive value. "
+
"please enter the hours worked again: " ); // prompt for positive value for hours worked
Hours = input.nextDouble(); // read hours worked again
System.out.println();
}

Double WeeklyPay = Rate * Hours; // Multiply rate times hours to get the weekly pay


// Print out
System.out.println("Employee Name: " + Name);
System.out.println();
System.out.print("Weekly Pay: $ " + WeeklyPay + " U.S. Dollars" );
System.out.println();

}

} // end method main

} // end class payroll2


See More: need help to identify error listed

Report •

#1
February 21, 2011 at 05:04:19
What is the error message your receiving ??

Report •
Related Solutions


Ask Question