Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A company pays its salespeople on a commission basis. The salespeople receive $2

ID: 3904011 • Letter: A

Question

A company pays its salespeople on a commission basis. The salespeople receive $200 per week plus 9% of their gross sales for that week. For example, a salesperson who sells $5000 worth of merchandise in a week receives $200 plus 9% of $5000, or a total of $650. You have been supplied with a list of the items sold by each salesperson. The values of these items are as follows: Item Value 239.99 129.75 99.95 4350.89 Write a Java program that inputs one salesperson's items sold for last week and calculates and displays that salesperson's earnings. There is no limit to the number of items that can be sold by a salesperson.

Explanation / Answer

As per your requirement i have written code which fulfill all your requirements please follow it step by step.

Commissionbase.java

public class Commissionbase {

private double basicearningsValue;

private double plusmerchandiseValue;

private double currentmrchandiseValue;

public void setplusMerchandiseMethod(double inmplusValue) {

plusmerchandiseValue = inmplusValue;

}

public void setEarningsbasicMethod (double inbearningsValue) {

basicearningsValue = inbearningsValue;

}

public Commissionbase(double inbearningsValue, double inmplusValue)

{

setEarningsbasicMethod(inbearningsValue);

setplusMerchandiseMethod(inmplusValue);

}

public void setmerchandisecurrentMethod (double inCMerchandise) {

currentmrchandiseValue = inCMerchandise;

}

public double getMerchandisecurrentMethod () {

return currentmrchandiseValue;

}

public double totalBasisMethod (){

double resultantValue = currentmrchandiseValue * plusmerchandiseValue + basicearningsValue;

return resultantValue;

}

}

Companypay.java

import java.util.Scanner;

public class Companypay {

public static void main (String args[]) {

// Declate intilize values

double basicEarnValue = 200.0;

double plusmerchandiseValue = 0.09;

int sectionValue = 5;

// create scanner object

Scanner scannerObject = new Scanner( System.in );

// print basic earn merchandise values

System.out.printf("The salespeople's basic earnings is $%.2f, merchandise plus is %.2f %%. ", basicEarnValue, plusmerchandiseValue * 100.0 );

Commissionbase salerObject = new Commissionbase( basicEarnValue, plusmerchandiseValue );

// First of all print without checking condition

do {

// print the list of all items values one by one.

System.out.println("Item Value ");

System.out.println("1 239.99 ");

System.out.println("2 129.75 ");

System.out.println("3 99.95 ");

System.out.println("4 350.89 ");

System.out.print(" Select sales item(Enter 0 to leave):");

sectionValue = scannerObject.nextInt();

// apply switch which satifies our requirement

switch(sectionValue){

case 1:

salerObject.setmerchandisecurrentMethod(salerObject.getMerchandisecurrentMethod() + 239.99);

break;

case 2:

salerObject.setmerchandisecurrentMethod(salerObject.getMerchandisecurrentMethod() + 129.75);

break;

case 3:

salerObject.setmerchandisecurrentMethod(salerObject.getMerchandisecurrentMethod() + 99.95);

break;

case 4:

salerObject.setmerchandisecurrentMethod(salerObject.getMerchandisecurrentMethod() + 350.89);

break;

case 0:

default:

break;

}

// print the current merchandise value

System.out.printf("Current merchandise is: $%.2f ", salerObject. getMerchandisecurrentMethod());

} while (sectionValue != 0);

// print the sales people total basis

System.out.printf("The salespeople's total basis you need to pay is : $%.2f", salerObject.totalBasisMethod ());

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote