This is how i try to run my JDK via cmd but i always get en error:
______________________________________________________
Microsoft Windows XP [Version 5.1.2600]
© Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\Elliona>cd desktop
C:\Documents and Settings\Elliona\Desktop>cd kirby
C:\Documents and Settings\Elliona\Desktop\kirby>path C:\java\bin
C:\Documents and Settings\Elliona\Desktop\kirby>javac payroll.java
C:\Documents and Settings\Elliona\Desktop\kirby>java payroll.java
Exception in thread "main" java.lang.NoClassDefFoundError: payroll/java
C:\Documents and Settings\Elliona\Desktop\kirby>
--------------------------------------------------------------------------------------
and this is my code... is there something wrong or missing?
import java.io.*;
import java.util.*;
public class payroll{
public static void main(String args[]) throws Exception {
File employee = new File("employee.txt");
File dtr = new File("dtr.txt");
PrintWriter pw = new PrintWriter(dtr);
Scanner filter = new Scanner(employee);
Scanner datain = new Scanner(System.in);
String empCode, empName, empLevel;
String covDate, covMonth, covYear;
String days[] = {"Monday","Tuesday","Wednesday","Thursday","Friday"};
String option;
double empSalRate;
double timeInA=0,timeOutA=0;
double minLate=0,rph=0,dailyTime=0,weeklyTime=0;
double dailyIncome=0,weeklyIncome=0,weeklyNet=0,weeklyIncomeA=0;
double totalOt=0,otIncome=0,otTime=0,tax=0,sss=0,deductions=0,allowance=500;;
double otIn,otInA=0,otOut,otOutA=0;
int ctr=0;
int timeIn, timeOut;
//Asking for an employee Code:!!!!!!!!!!!!!!!!!!
System.out.print("Enter an Employee Code:");
empCode=datain.nextLine();
while(filter.hasNext()){
if(empCode.equals(filter.nextLine())){
empName=filter.nextLine();
empLevel=filter.nextLine();
empSalRate=filter.nextDouble();
System.out.println("*************************************");
System.out.println("Employee Name:"+empName);
System.out.println("Employee Level:"+empLevel);
System.out.printf("Salary Rate :Php%.2f\n",empSalRate);
System.out.println("*************************************");
pw.println("***********************************");
pw.println("Employee Code:"+empCode);
pw.println("Employee Name:"+empName);
pw.println("Employee Level:"+empLevel);
pw.println("Salary Rate :Php"+empSalRate+"0");
pw.println("***********************************");
//Asking for timeIn and timeOut and screening undertime and late:!!!!!!
do {
System.out.println("------------------------------");
System.out.print("Enter time in for "+days[ctr]+":");
timeIn=datain.nextInt();
if(timeIn>=1700)
timeInA = 1700;
else if(timeIn>=1600)
timeInA = 1600;
else if(timeIn>=1500)
timeInA = 1500;
else if(timeIn>=1400)
timeInA = 1400;
else if(timeIn>=1300)
timeInA = 1300;
else if(timeIn>=1200)
timeInA = 1200;
else if(timeIn>=1100)
timeInA = 1100;
else if(timeIn>=1000)
timeInA = 1000;
else if(timeIn>=900)
timeInA = 900;
else if(timeIn>=800)
timeInA = 800;
else if(timeIn<=800)
{timeInA = 800;
timeIn = 800;}
pw.println("Enter time in for "+days[ctr]+"\t:"+timeIn);
System.out.print("Enter tim out for "+days[ctr]+":");
timeOut=datain.nextInt();
if(timeOut>=1700)
timeOutA = 1700;
else if(timeOut>=1600)
timeOutA = 1600;
else if(timeOut>=1500)
timeOutA = 1500;
else if(timeOut>=1400)
timeOutA = 1400;
else if(timeOut>=1300)
timeOutA = 1300;
else if(timeOut>=1200)
timeOutA = 1200;
else if(timeOut>=1100)
timeOutA = 1100;
else if(timeOut>=1000)
timeOutA = 1000;
else if(timeOut>=900)
timeOutA = 900;
else if(timeOut>=800)
timeOutA = 800;
else if(timeOut<=800)
{timeOutA = 800;
timeOut = 800;}
pw.println("Enter time out for "+days[ctr]+"\t:"+timeOut);
//Formula for dailyTime, weeklyTime and Late:!!!!!!!!!!!!!!!!
if(timeIn>=1300) {
minLate=0;
dailyTime=((timeOutA-timeInA)/100)-minLate;
}
else {
minLate=(timeIn-timeInA)/60;
dailyTime=(((timeOutA-timeInA)/100)-minLate)-1;
}
rph=empSalRate/8;
dailyIncome=dailyTime*rph;
weeklyTime=weeklyTime+dailyTime;
weeklyIncome=weeklyIncome+dailyIncome;
System.out.println(" ");
System.out.print("Is"+days[ctr]+" a holiday? [Yes=y/No=n]");
option=datain.next();
if(option.equals("n")) {
System.out.println(" ");
System.out.print("Enter Overtime in for "+days[ctr]+":");
otIn=datain.nextInt();
if(otIn>=2200)
otInA=2200;
else if(otIn>=2100)
otInA=2100;
else if(otIn>=2000)
otInA=2000;
else if(otIn>=1900)
otInA=1900;
else if(otIn>=1800)
otInA=1800;
else if(otIn>=1700)
otInA=1700;
pw.println("Enter OverTime in for "+days[ctr]+"\t:"+otIn);
System.out.print("Enter Overtime out for "+days[ctr]+": ");
otOut=datain.nextInt();
if(otOut>=2200)
otOutA=2200;
else if(otOut>=2100)
otOutA=2100;
else if(otOut>=2000)
otOutA=2000;
else if(otOut>=1900)
otOutA=1900;
else if(otOut>=1800)
otOutA=1800;
else if(otOut>=1700)
otOutA=1700;
pw.println("Enter OverTime out for "+days[ctr]+"\t:"+otOut);
System.out.println("--------------------------------");
otTime=(otOutA-otInA)/100;
totalOt=totalOt+otTime;
}
else {
rph=empSalRate/8;
dailyIncome=(dailyTime*rph)*1.1;
}
weeklyIncomeA=weeklyIncomeA+dailyIncome;
ctr=ctr+1;// or ctr++
} while(ctr<=4);
System.out.println("*******************************");
System.out.print("Enter Coverage Date: ");
covMonth=datain.next();
covDate=datain.next();
covYear=datain.next();
otIncome=(totalOt*rph)*1.1;
weeklyIncomeA=(weeklyIncomeA+otIncome);
tax=weeklyIncome*.1;
sss=weeklyIncome*.01;
deductions=(tax+sss);
weeklyNet=(weeklyIncomeA-deductions)+allowance;
pw.println("********************************");
pw.print("Enter Coverage Date: ");
System.out.print(" ");
System.out.println("========================================");
System.out.println("======== TESDA Payroll System =======");
System.out.println("========================================");
System.out.println("Employee Name: "+empName);
System.out.println("Employee Code: "+empCode);
System.out.println("Employee Level: "+empLevel);
System.out.printf("Salary Rate :Php %.2f",empSalRate);
System.out.println("/day");
System.out.println("*****************************************");
System.out.println("Date Covered\t: "+covMonth+" "+covDate+","+covYear);
System.out.printf("TOtal Number of Work Hours: %.0f",weeklyTime);
System.out.println(" Hours");
System.out.printf("OverTime Hours\t: %.0f",totalOt);
System.out.println(" Hourse");
System.out.printf("Regular Income\t: "+"Php %.2f\n",weeklyIncome);
System.out.printf("OverTime Income\t: "+"Php %.2f\n",otIncome);
System.out.printf("Gross Income\t: "+"Php %.2f\n",weeklyIncomeA);
System.out.println("Deductions:");
System.out.printf(" *Tas: %.2f\n",tax);
System.out.printf(" *SSS: %.2f\n",sss);
System.out.println("******************************************");
System.out.printf("**** Net Income: Php %.2f",weeklyNet);
System.out.println(" *********");
System.out.println("******************************************");
pw.close();
}
}
filter.close();
}
}