So I am working on a project to get data from a text file to calculate things like payment and tax. This is what I have so far and don't know where to go from here. I can't even open the text file for the data. Any help would be appreciated!
newdata.txt
id; name; position; hourly rate; hours worked
That is the text file containing the input data ^.
The output should be something like this:
Output:
Employee ID: 1
Employee Name: ab
Position: c
Gross Pay: $400000.00
Federal Taxes: $120000.00
Net Pay: $280000.00
Output file:
1; ab c; $280000.00
...
package payroll;
import java.util.ArrayList;
import java.util.Scanner;
import java.io.File;
import java.io.FileReader;
import java.io.PrintWriter;
public class Employee {
private int id;
private String name;
private double wage;
private double hoursWorked;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getWage() {
return wage;
}
public void setWage(double wage) {
this.wage = wage;
}
public double getHoursWorked() {
return hoursWorked;
}
public void setHoursWorked(double hoursWorked) {
this.hoursWorked = hoursWorked;
}
public String toString() {
return null;
}
public static void main(String[] args) {
File myFile = new File("newdata.txt");
System.out.println(myFile);
Employee employee1 = new Employee();
employee1.getId();
employee1.getName();
employee1.getWage();
employee1.getHoursWorked();
}
}