Rebuild Lab 3 Salesperson Bonus to read the inputs from an XML file of your own design.
Question:
Rebuild Lab 3 Salesperson Bonus to read the inputs from an XML file of your own design. Ensure your program can handle any number of input lines from the file.
Project Name: Lab_9_Salesperson_Bonus
Below is the code from Lab 3 Salesperson Bonus:
public static void main(String[] args) {
// TODO code application logic here
Scanner input = new Scanner(System.in);
//Input information
double[] sales = new double[10];//Declaring array to store sales amounts
double[] bonus = new double[10];//Declaring array to store bonus after calculation
double totalsales = 0, totalbonus = 0;//Variables declared to store total sales and bonus
//Entering the values for the sales
System.out.println("Enter the sales amount for the 10 salespeople\n");
//Using loop to enter the sales amount for 10 salespeople
for(int i =0;i<10;i++)
{
System.out.println("Amount for salesperson " + (i+1) + ":");
sales[i] = input.nextDouble();
totalsales = sales[i]+totalsales;//Calculating the total sales and stores them in the variable
}
//Calculating the bonus using the loop
for(int i =0;i<10;i++)
{
if(sales[i]>60000)//if to check the sales is greater than 60000
{
bonus[i] = (sales[i]*5)/100;//Calculating the bonus with 5% and stores in the array
totalbonus = totalbonus + bonus[i];//Calculating the total bonus
}
else//Sales amount is less than 60000
{
bonus[i] = (sales[i]*2)/100;//Calcualting the bonus amount using 2% bonus
totalbonus = totalbonus + bonus[i]; //Total bonus is calculating
}
}
//Prints results
System.out.println("\nTOTAL SALES: $"+ (int)Math.round(totalsales));
System.out.println("\nTOTAL SALES BONUS: $"+ (int)Math.round(totalbonus));
}
}
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill