"Enter the Employees Name.Exception in thread "main" java.util.NoSuchElementException: No line found
at java.util.Scanner.nextLine(Scanner.java:1516)
at payrollp1.main(payrollp1.java:20)
Tool completed with exit code 1
"
And I am so lost at what I am to do with that type of error...Can someone help please?
here is my code...
import java.util.Scanner; //program uses the class scanner
public class payrollp1
{
// main method begins
public static void main(String args[] )
{
// creates scanner to obtain the input necessary to execute the program
java.util.Scanner input= new Scanner(System.in);
String Name
double Rate;
double Worked;
// allows the user to enter the employees name
System.out.print( "Enter the Employees Name." );
// sets the employees name
Name = input.nextLine();
// gives the user a chance to enter the hours the employee worked
System.out.print( "Enter the number of hours the employee worked." );
//sets the number of hours the employee worked
Worked = input.nextDouble();
// gets the hourly rate at which the employee will gain
System.out.print( "Enter the pay in which the employee will receive per hour." );
// sets the hourly rate the employee will earn
Rate = input.nextDouble();
System.out.printf("Employee" +Name+ "\n");
System.out.printf("Pay:$%.2f", Rate*Worked);
} // end main method
} // end Class payrollp1
What would be the easiest way to change this error message without running into creating more errors? Please help.
This post has been edited by makaylaa21: 09 October 2010 - 08:54 PM
Reason for edit:: Added code tags

New Topic/Question
Reply




MultiQuote





|