Hello , can someone please complete this in Java programming. Email to telsabake
ID: 3739929 • Letter: H
Question
Hello , can someone please complete this in Java programming. Email to telsabaker 10 @ G mail . com
One company request a application that allows users to READ from the keyboard the information of a vendor: name (String), id (String), sale amount in the month (double) then calculate the salary of vendors based on the sale amount in the month to get base salary, commission or bonus Base salar 2500 2500 Commission 0 3.5% on extra sales beyond 20,000 4.2% on extra sales Bonus 0 AMOUNT OF SALE PER MONTH 0 to 20,000 20,000 to 30,000 2% on any sales beyond greater than $30000 2500 nd 20,000 The salary of a vendor in the month will be Salary base salary+commission +bonus The output should be Vendor Name Vendor ID Total sale Base Salary: Commission Bonus: Total Amount made: Smith Crystal 12345 32254 2500 504.67 45.08 3049.75Explanation / Answer
VendorsSalary.java
import java.util.Scanner;
public class VendorsSalary {
public static void main(String[] args) {
//Declaring variables
String id,name;
double saleAmount,baseSalary=0,commission=0,bonus=0,totAmt;
/*
* Creating an Scanner class object which is used to get the inputs
* entered by the user
*/
Scanner sc = new Scanner(System.in);
//Getting the input entered by the user
System.out.print("Enter Vendor name :");
name=sc.nextLine();
System.out.print("Enter Vendor Id :");
id=sc.next();
System.out.print("Enter Total Sale :");
saleAmount=sc.nextDouble();
//calculating the basesalary,commisssion,bonus
if(saleAmount>=0 && saleAmount<20000)
{
baseSalary=2500;
commission=0;
bonus=0;
}
else if(saleAmount>=20000 && saleAmount<30000)
{
baseSalary=2500;
commission=0.035*(saleAmount-20000);
bonus=0;
}
else if(saleAmount>=30000)
{
baseSalary=2500;
commission=0.042*(saleAmount-20000);
bonus=0.02*(saleAmount-30000);
}
//calculating the total Amount
totAmt=baseSalary+commission+bonus;
//Displaying the output
System.out.println(" ------------------------");
System.out.println("Vendor Name: "+name);
System.out.println("Vendor ID: "+id);
System.out.println("Total Sale: "+saleAmount);
System.out.println("Base Salary: "+baseSalary);
System.out.println("Commission: "+commission);
System.out.println("Bonus: "+bonus);
System.out.println("Total Amount: "+totAmt);
System.out.println("------------------------");
}
}
_____________________
Output:
Enter Vendor name :Smith Crystal
Enter Vendor Id :12345
Enter Total Sale :32254
------------------------
Vendor Name: Smith Crystal
Vendor ID: 12345
Total Sale: 32254.0
Base Salary: 2500.0
Commission: 514.668
Bonus: 45.08
Total Amount: 3059.748
------------------------
_______________Thank you
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.