Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class SalesCommissionCalculator {
- public void SalesCommusion()
- {
- Scanner input = new Scanner(System.in);
- int items = 0;
- double commission;
- int numberSold;
- double gross = 0.0;
- while (items < 4)
- {
- items++;
- System.out.printf("Enter number of products (%d) sold : ", items);
- numberSold = input.nextInt();
- if (items == 1)
- {
- gross = numberSold * 239.99;
- }
- else if (items == 2)
- {
- gross = numberSold * 129.95;
- }
- else if (items == 3)
- {
- gross = numberSold * 99.95;
- }
- else if (items == 4)
- {
- gross = numberSold * 350.89;
- }
- commission = ((0.09 * gross) + 200.0);
- System.out.println("The commission is: " + commission);
- }
- }
- }
- public class SalesCommissionCalculatorTest {
- public static void main(String[] args) {
- SalesCommissionCalculator sales = new SalesCommissionCalculator();
- sales.SalesCommusion();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement