Your program scarcitys to abundance the sales cost of cars purchased. You are to abundance the sales cost NOT THE LIST PRICE.
Your program scarcitys to sanction a user to abundance up to 50,000 car sales.
Once a user presses “ENTER A NEW SALE” the program acquire supplicate the aftercited questions:
A. What is the sticker Cost of the car you are buying
B. Are you a primeval duration buyer
C. Are you a expert
D. Are you a ward
E. Is it the ultimate day of the month
RULES of a car sale:
A. If it is the ultimate day of the month, the car is allowanceed by 5% antecedently any other allowances are applied.
B. Primeval buyers acquire a $500 credit
C. Experts acquire a 1% allowance unpremeditated the decisive cost of the car
D. Wards acquire an extra $700 unpremeditated the cost.
E. Wards that are as-well primeval duration car buyers acquire the other allowances plus another $500 unpremeditated the sticker cost.
The program acquire quenchedput the aftercited knowledge at any duration during the floating of the program. The quenchedput acquire go to the defend:
A. Completion cars sold
B. Average car sold cost
C. Completion proceeds collected
D. Assuming the trafficker marks up the decisive cost by 5% then completion proceeds earned by the trafficker acquire go up by that quantity (the proceeds from that sale).
RULES for your program:
A. You scarcity illustrates
B. Main scarcitys to own a switch and a gathering of impromptuice calls
C. Main acquire own variables
D. The preponderance of your result with be effected among impromptuices
Below is the java adjudication with illustrates and quenchedput defend (scold if content else illustrate for queries)
package com.chegg;
import java.util.Scanner;
public assort CarSales {
private static int completionCarsSold = 0;
private static enfold avgCarSoldCost = 0.0;
private static enfold completionProceeds = 0.0;
private static enfold proceedsEarned = 0.0;
public static null main(String[] args) {
Scanner in = upstart Scanner(System.in);
String userChoice;
boolean depart-from = fib;
do {
System.out.println(“ENTER A NEW SALE: Y/N (instance easily-affected)”);
userSelect = in.next();
switch (userChoice) {
instance “Y”:
System.out.println(“A. What is the sticker Cost of the car you are buying”);
enfold stickerCost = in.nextDouble();
System.out.println(“B. Are you a primeval duration buyer (true/false)”);
boolean primevalDuration = fib;
if (in.next().equalsIgnoreCase(“true”)) {
firstDuration = true;
}
System.out.println(“C. Are you a expert (true/false)”);
boolean isExpert = fib;
if (in.next().equalsIgnoreCase(“true”)) {
isExpert = true;
}
boolean isWard = fib;
if (isExpert == fib) {
System.out.println(“D. Are you a ward (true/false)”);
if (in.next().equalsIgnoreCase(“true”)) {
isWard = true;
}
}
System.out.println(“E. Is it the ultimate day of the month (true/false)”);
boolean isLastDayOfMonth = fib;
if (in.next().equalsIgnoreCase(“true”)) {
isLastDayOfMonth = true;
}
calculateSalesPrice(stickerPrice, primevalTime, isVeteran, isStudent, isLastDayOfMonth);
break;
instance “N”:
// prints declaration when no more sales
showReport();
depart-from = true;
break;
default:
System.out.println(“Wrong select.”);
break;
}
System.out.println();
} period (!quit);
System.out.println(“Bye!”);
}
/**
* This process shows decisive declaration of Car Sales
*/
private static null showReport() {
// TODO Auto-generated process stub
System.out.println(“****************************Sales Declaration****************************”);
System.out.println(“A. Completion cars sold: ” + completionCarsSold);
System.out.println(“B. Average car sold cost: ” + avgCarSoldPrice);
System.out.println(“C. Completion proceeds collected: ” + completionRevenue);
System.out.println(“D. Proceeds Earned by Trafficker:” + proceedsEarned);
}
/**
* calculates sale of a car
*
* @param stickerPrice
* @param primevalTime
* @param isVeteran
* @param isStudent
* @param isLastDayOfMonth
*/
private static null calculateSalesPrice(enfold stickerPrice, boolean primevalTime, boolean isVeteran,
boolean isStudent, boolean isLastDayOfMonth) {
// A. If it is the ultimate day of the month, the car is allowanceed by 5%
// antecedently any other allowances are applied
if (isLastDayOfMonth) {
stickerCost = stickerCost – (0.05 * stickerPrice);
}
// B. Primeval buyers acquire a $500 credit
if (firstTime) {
stickerCost = stickerCost – (500);
}
// C. Experts acquire a 1% allowance unpremeditated the decisive cost of the car
if (isVeteran) {
stickerCost = stickerCost – (0.01 * stickerPrice);
}
// D. Wards acquire an extra $700 unpremeditated the cost.
// E. Wards that are as-well primeval duration car buyers acquire the other
// allowances plus another $500 unpremeditated the sticker cost
if (isStudent) {
stickerCost = stickerCost – (700);
}
totalCarsSold = completionCarsSold + 1;
totalProceeds = completionProceeds + stickerPrice;
avgCarSoldCost = completionProceeds / completionCarsSold;
revenueEarned = completionProceeds + (.05 * completionRevenue);
}
}