I am a student taking a java class online. its kinda hard because I don't have anyone to talk to directly.
I do not want someone to do this for me i just want a simple yes or no answer.
I have created a program for my second assignment.
The application displays text that requests the user input the name of the employee, the hourly rate, and the number of hours worked for that week. The application then prints out the name of the employee and the weekly pay amount.
my code for this application is as follows :
import java.util.Scanner; // program uses class Scanner
public class PayrollApp
{
// main method begins execution of java application
public static void main(String args[])
{
// create a scanner to obtain input in command window
Scanner input = new Scanner( System.in );
String employeename; // Name of employee
double hourlyrate; // Amount made in one hour
double hoursworked; // Number of hours worked in one week
double weeklypay; // The multiple of hourly rate and hours worked in one week
System.out.println("Enter an employee name:"); //prompt
employeename = input.nextLine();
System.out.println( "Enter Hourly Rate: "); // prompt
hourlyrate = input.nextDouble(); // read hourly rate
System.out.print( "Enter Hours Worked: "); // prompt
hoursworked = input.nextDouble(); // read hours worked
// calculate weekly pay
weeklypay = hourlyrate * hoursworked; // multiply numbers
// display employee name and weekly pay
System.out.printf( "Weekly Pay for %s,is $%.2f\n", employeename, weeklypay);
} // end method main
} // end class
End code:
I am currently using netbeans and the line that says public class PayrollApp
gives me an error that says i have to define the class PayrollApp in another file.
My question is this. do i need to define it in another file. and if so what do i include?
(i am sorry, being new to this i may not be asking the question correctly)