By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,578 Members | 855 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,578 IT Pros & Developers. It's quick & easy.

There is no error but it came out could not find or load main class Employees

P: 1
import java.util.Scanner;

import javax.swing.JOptionPane;

public class Employee{



public static void main (String[]args) {
@SuppressWarnings("resource")
Scanner input = new Scanner(System.in);
System.out.println("Employees Full Name:");
String FullName = input.nextLine();
System.out.println("Employees Full Name:"+ FullName);
System.out.println("Hours of worked in a week:");
int HW = input.nextInt();
System.out.println("Hourly Pay Rate:");
double hPayr = input.nextDouble();
int GTaxR = input.nextInt();
int ETaxR = input.nextInt();

JOptionPane.showMessageDialog(null, FullName);
System.out.println("Employees Full Name:"+ FullName);

double GrossPay = hPayr * HW;
System.out.println("Gross Pay:"+ "$" + GrossPay);
System.out.println("Deductions:");
double GTax = GTaxR * GrossPay;
System.out.println("Government Tax: "+ GTax);
double ETax = ETaxR * GrossPay;
System.out.println("Employment Tax: "+ ETax);
double TDeduction = GTax + ETax;
System.out.println("Total Deductions: "+ "$"+ TDeduction);
double NetPay = GrossPay * TDeduction;
System.out.println("Net Pay: "+ "$"+ NetPay);

}
}
Mar 15 '19 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 785
Please use code tags to show your code formatted here, else it's wasted time for a free helper.

You have called your class "Employee", without s at the end. So if you try to start "Employees", with s at the end, it will not work.

Can you please write down here how you start it? From command line instead of IDE? Then maybe you also forgot to compile it first.
You should compile and start it from command line by:
Expand|Select|Wrap|Line Numbers
  1. javac Employee.java
  2. java Employee
Apr 5 '19 #2

Post your reply

Sign in to post your reply or Sign up for a free account.