forked from singhmayank980/Hactoberfest2021
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSalaryClaculator.java
53 lines (37 loc) · 1.42 KB
/
SalaryClaculator.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import java.util.Scanner;
public class SalaryClaculator{
public static void main (String args[]){
// variable declaration
String name;
int noOfUnitsSold;
double unitPrice;
double commission = 0;
double SalesValue;
double basicSalary = 25000.00;
double finalSalary;
// getting the user inputs
Scanner input = new Scanner(System.in);
System.out.print("Enter Sales Represenatative Name : ");
name = input.next();
System.out.print("Enter the Number of Units Sold : ");
noOfUnitsSold = input.nextInt();
System.out.print("Enter the Unit Price : ");
name = input.nextDouble();
// do the necessary calculations - process
salesValue = noOfUnitsSold * unitPrice;
if (salesValue >= 100000){
commission = (salesValue - 100000)*5/100;
}
// output
System.out.println("=========== Sales Report ============");
System.out.println("Sales Representative Name : "+name );
System.out.println("Number of Units Sold : "+noOfUnitsSold);
System.out.println("Unit Price : "+unitPrice);
System.out.println("Sales Valve : "+SalesValue);
System.out.println("Basic Salary : "+basicSalary);
System.out.println("Commission : "+commission);
System.out.println("Final Salary : "+finalSalary);
System.out.println("=============== End =================");
}
}
// Do a little analysis about my code - What do you think :)