Java Program to input ID number, Name and Total sales of a salesman. Find the allowance give to the salesman, if the sales is more than 5000 the n TA=5% of the sales
D.A. =10% of the sales
Commission = 7% of the sales
Allowance= TA + DA + Commission
Answers
//This " package com.company " is only for intelly j software
package com.company;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner n = new Scanner(System.in);
System.out.print("Enter your ID ");
int id = n.nextInt();
System.out.print("Enter your first name ");
String firstName = n.next();
System.out.print("Enter your last name ");
String lastName = n.next();
System.out.print("Enter sales number");
int sales = n.nextInt();
String name = firstName + " " + lastName;
double TA = sales/100*5;
double DA = sales/100*10;
double commission = sales/100*7;
if ( sales >= 5000){
System.out.print("ID = " + id + "\n" + "Name = " + name + "\n" + "Sales =" + sales + "\n" );
double allowance = TA + DA + commission;
System.out.print("Your Allowence is " + allowance );
}
else {
double allowance = DA + commission;
System.out.print("Your Allowence is " + allowance );
}
}
}