/***************************************************************
*Filename: Burs.java
*@author : Emmanuel Ayotunde 202100475
*Program to compile : javac Burs.java
*Program to execute : java Burs
*Input is reads from the keyboard */
//Import packages required for the program
import java.util.Scanner;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
///////////////////////////////
public class Burs
{
public static void main(String[] args) throws IOException
{
Scanner kb = new Scanner(System.in); //To read from the keyboard
//Prompts below this code//////////////////////////////////////////////////////////////////
System.out.print("Enter file input:"); //ask the user to enter filename
String filename = kb.next(); //reads the input
System.out.print("Enter file output:"); //asks the user to enter output file
String outFile = kb.next(); //reads the output filename
///////////////////////////////////////////////////////////////////////////////////
//Scanners and PrintWriter class
Scanner inFile = new Scanner(new FileReader(filename)); //reads from the filename
PrintWriter pw = new PrintWriter("outFile"); //Print data onto outFile file
//Variables for later use below line of code////////////////////////////////
String fName = "";
String fromContains = "";
double fromSalary = 0.0;
String fromNumber = "";
int N = 0;
int count = 0;
double tax = 0.0;
//////////////////////////////////////////////////////////////////////
//Reading file contents
if(inFile.hasNext())
{
}
while(inFile.hasNextLine()) //booleans to check if file has data
{
String contains = inFile.nextLine(); //Reads the non-primitive data types
double salary = inFile.nextDouble(); //Reads the salaries
String number = inFile.next(); //reads employee ID number
count++;
//Compare and exchange
if(salary > fromSalary)
{
fromContains = contains;
fromSalary = salary;
fromNumber = number;
}
//Conditions for different intervals
if(fromSalary >= 1 && fromSalary <= 226000)
{
tax = fromSalary * 18 / 100;
}
else if(fromSalary >= 226001 && fromSalary <= 353100)
{
tax = (fromSalary * 26 / 100) + 40680;
}
else if(fromSalary >= 353101 && fromSalary <= 488700)
{
tax = (fromSalary * 31 / 100) + 73726;
}
else if(fromSalary >= 488701 && fromSalary <= 641400)
{
tax = (fromSalary * 36 / 100) + 115672;
}
else if(fromSalary >= 641401)
{
tax = (fromSalary * 39) + 170734;
}
pw.printf("%s %d %.2f %.2f",fromContains,fromNumber,fromSalary,tax); //Prints onto new file
}
kb.close();
inFile.close();
pw.close();
}
}
How do I fix the issue?