it is telling me that there are no main methods found and it cant run. let me kn
ID: 3643421 • Letter: I
Question
it is telling me that there are no main methods found and it cant run. let me know on any other mistakes also.thanks//Lab3 template by: Jack McDermott
//this makes available all extra utilities from Java library including scanner
import java.util.*;
import java.io.*; //needed for files
public static class {Lab3.java}
{// start of class
Scanner keyIn = new Scanner(System.in);
// assigns "keyIn" to keyboard
Scanner inPayrollFile = new scanner(new Filereader("Lab3Input.txt"));
// assigns "inPayrollFile" to input file
PrintWriter outPayrollFile = new PrintWriter("Lab3Output.txt");
// assigns "outPayrollFile" to output file
//System.out displays on the moniter
//Variables and defined constants go here
int empID; //employee ID number
double hours; //hours worked
double rate; //hourly pay rate
int code; //department code number
double reg; //regular hours worked
double OT; //overtime hours worked
double gross; //gross pay for employee
double bonus; //bonus pay amount
double deduct; //deduction taken from employees pay
double net; //net pay for employee
int totalEmp; //total number of employees
double totalGross=0; //total gross pay
double totalDeduct=0; //total deduction taken
double totalNet=0; //total net pay
int file; //number of payroll file being used
char name; //name of employees department
///////////////////////////////////////////////////////////////////////////////
//instructions start here
//before loop instructions go here
{ outPayrollFile.println (HEADING1);
}
///////////////////////////////////////////////////////////////////////////////
//loop, which has input, process, output
{ while(inPayrollFile.hasNext())
//start while loop - hasNext is TRUE when there is an input record
// hasNext is False when no more input records - the loop ends
//inout - within loop
empID = inPayrollFile.nextInt() ; //example of reading from input file
hours = inPayrollFile.nextdouble();
rate = inPayrollFile.nextdouble();
code = inPayrollFile.nextInt() ;
//process - within loop
gross = reg + OT;
net = gross + bonus - deduct;
//output - within loop
totalEmp = totalEmp + 1;
totalGross = totalGross + gross;
totalDeduct = totalDeduct + deduct;
totalNet = totalNet + net;
outPayrollFile.printf("%4d", empID);
outPayrollFile.printf("%6.2f", hours);
outPayrollFile.printf("%6.2f", rate);
outPayrollFile.printf("%8.2f", gross);
outPayrollFile.printf("%8.2f", deduct);
outPayrollFile.printf("%8.2f%n", net);
{
int code = 4;
switch(code)
{
case 1: System.out.println ();
if(code = 20)
name = Administration;
case 2: System.out.println ();
if(code = 23)
name = Production;
case 3: System.out.println ();
if(code = 25)
name = Sales;
case 4: System.out.println ();
if(code != 20|23|25)
name = InvalidDept;
} //end switch(code)
}//end while loop
////////////////////////////////////////////////////////////////////////////
//after loop instructions go here
outPayrollFile.printf("totalEmployees = %4d" , totalEmp);
outPayrollFile.printf("totalGross = %7.2f", totalGross);
outPayrollFile.printf("totalDeduction = %7.2f", totalDeduct);
outPayrollFile.printf("totalNet = %7.2f", totalNet);
inPayrollFile.close();
outPayrollFile.close();
System.out.println ();
System.out.println ("PROGRAM COMPLETED by Jack McDermott");
}//end of main
////////////////////////////////////////////////////////////////////////////
//gross pay method goes here
////////////////////////////////////////////////////////////////////////////
public static double OT (hours, rate);
{
{
double OT;
if (hours <= 40)
OT = 0;
else
OT = ((hours>40) - 40) * (rate*1.5);
double roundTwoDecimals;
DecimalFormat twoDForm = new DecimalFormat("#.##");
return Double.valueOf(twoDForm.format(d));
return OT;
}
}
{
double reg;
reg = (hours<=40)*rate;
double roundTwoDecimals;
DecimalFormat twoDForm = new DecimalFormat("#.##");
return Double.valueOf(twoDForm.format(d));
return reg;
}
////////////////////////////////////////////////////////////////////////////
//bonus pay method goes here
////////////////////////////////////////////////////////////////////////////
public static double bonus (hours, gross);
{
double bonus;
if(code != 25)
bonus = 0;
if(code = 25 && hours >= 40)
bonus = gross * .10;
if(code = 25 && hours < 40)
bonus = gross * .05;
double roundTwoDecimals;
DecimalFormat twoDForm = new DecimalFormat("#.##");
return Double.valueOf(twoDForm.format(d));
return bonus;
}
}
////////////////////////////////////////////////////////////////////////////
//deduction pay method goes here
////////////////////////////////////////////////////////////////////////////
public static double deduct (double gross)
{
{
double deduct;
if(gross <= 500)
deduct = gross * .20;
else
if(500 < gross <= 1000)
deduct = 100 + ((gross - 500) * .25);
else
if(gross > 1000)
deduct = 225 + ((gross - 1000) * .30);
double roundTwoDecimals;
DecimalFormat twoDForm = new DecimalFormat("#.##");
return Double.valueOf(twoDForm.format(d));
return deduct;
}
}
}
//end of class
Explanation / Answer
You got it wrong. Type the following code: import java.util.*; import java.io.*; public static class Lab3 { public static void main(String args[]) { Scanner keyln... And go on as usual.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.