Java Program** Write a program to perform these computations. For each employee,
ID: 3738569 • Letter: J
Question
Java Program**
Write a program to perform these computations. For each employee, your program should print employee name, total sales count, total dollar amount of sales, and total commission. At the end, print grand totals of sales count, dollar amount, and commissions. Use a function to compute the commission. Insert tests in your program to ensure that the sales date and amount are meaningful. The month being processed should be entered at the start of execution.
Your program must use function(s) and must be Object Oriented. Your function(s) must use arguments.
Salesperson NameMake of CarDate of SaleAmount of Sale For example: LITTLE NELL CADILLAC 6/24 $8532.67Explanation / Answer
Implemented code as per the requirement. Please comment if you have face any difficulty or if you need any modification.
Code:
=====
import java.util.Scanner;
public class Test{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter name: ");
String name = sc.nextLine();
System.out.print("Enter sales: ");
Double sales = Double.parseDouble(sc.nextLine());
if(sales<=30000){
System.out.println("Commission for the employee "+name+" is "+((sales/100.0)*5.0));
}
else if(sales>30000 && sales<=50000){
double comm1 = (30000/100)*5.00, comm2 = ((sales-30000)/100)*8.0;
System.out.println("Employee name: "+name);
System.out.println("Commission till 30000: "+comm1);
System.out.println("Commission above 30000: "+comm2);
System.out.println("Total commission : "+comm1+comm2);
}
else if(sales>50000){
double comm1 = (30000/100)*5.00, comm2 = (20000/100)*8.00, comm3 = ((sales-30000)/100)*15.0;
System.out.println("Employee name: "+name);
System.out.println("Commission till 30000: "+comm1);
System.out.println("Commission till 50000: "+comm2);
System.out.println("Commission above 50000: "+comm3);
System.out.println("Total commission : "+comm1+comm2+comm3);
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.