Homework Solution: Your program needs to store the sales price of cars purchased. You are to store the sales price NOT…

    Your program needs to store the sales price of cars purchased. You are to store the sales price NOT THE LIST PRICE. Your program needs to allow a user to store up to 50,000 car sales. Once a user presses “ENTER A NEW SALE” the program will ask the following questions: A. What is the sticker Price of the car you are buying B. Are you a first time buyer C. Are you a veteran D. Are you a student E. Is it the last day of the month RULES of a car sale: A. If it is the last day of the month, the car is discounted by 5% before any other discounts are applied. B. First buyers get a $500 credit C. Veterans get a 1% discount off the final price of the car D. Students get an extra $700 off the price. E. Students that are also first time car buyers get the other discounts plus another $500 off the sticker price. The program will output the following information at any time during the running of the program. The output will go to the screen: A. Total cars sold B. Average car sold price C. Total revenue collected D. Assuming the dealer marks up the final price by 5% then total revenue earned by the dealer will go up by that amount (the revenue from that sale). RULES for your program: A. You need comments B. Main needs to have a switch and a bunch of function calls C. Main will have variables D. The majority of your work with be done within functions

    Expert Answer

     
    Below is the java code with comments and output screen (rate if satisfied else comment for queries) package com.chegg; import java.util.Scanner;

    Your program demands to treasury the sales worth of cars purchased. You are to treasury the sales worth NOT THE LIST PRICE.

    Your program demands to remit a user to treasury up to 50,000 car sales.

    Once a user presses “ENTER A NEW SALE” the program gain petition the subjoined questions:

    A. What is the sticker Worth of the car you are buying

    B. Are you a leading date buyer

    C. Are you a expert

    D. Are you a ward

    E. Is it the latest day of the month

    RULES of a car sale:

    A. If it is the latest day of the month, the car is abatemented by 5% precedently any other abatements are applied.

    B. Leading buyers achieve a $500 credit

    C. Experts achieve a 1% abatement impromptu the definite worth of the car

    D. Wards achieve an extra $700 impromptu the worth.

    E. Wards that are too leading date car buyers achieve the other abatements plus another $500 impromptu the sticker worth.

    The program gain quenchedput the subjoined knowledge at any date during the floating of the program. The quenchedput gain go to the shade:

    A. Aggregate cars sold

    B. Average car sold worth

    C. Aggregate proceeds collected

    D. Assuming the tradesman marks up the definite worth by 5% then aggregate proceeds earned by the tradesman gain go up by that whole (the proceeds from that sale).

    RULES restraint your program:

    A. You demand expounds

    B. Ocean demands to bear a switch and a throng of exercise calls

    C. Ocean gain bear variables

    D. The preponderance of your labor with be performed among exercises

    Expert Vindication

     

    Below is the java enactment with expounds and quenchedput shade (rate if pleased else expound restraint queries)

    package com.chegg;

    import java.util.Scanner;

    public class CarSales {

    private static int aggregateCarsSold = 0;

    private static enfold avgCarSoldWorth = 0.0;

    private static enfold aggregateProceeds = 0.0;

    private static enfold proceedsEarned = 0.0;

    public static lacking ocean(String[] args) {

    Scanner in = strange Scanner(System.in);

    String userChoice;

    boolean depart-from = mock;

    do {

    System.out.println(“ENTER A NEW SALE: Y/N (condition sentient)”);

    userSelect = in.next();

    switch (userChoice) {

    condition “Y”:

    System.out.println(“A. What is the sticker Worth of the car you are buying”);

    enfold stickerWorth = in.nextDouble();

    System.out.println(“B. Are you a leading date buyer (true/false)”);

    boolean leadingDate = mock;

    if (in.next().equalsIgnoreCase(“true”)) {

    firstDate = true;

    }

    System.out.println(“C. Are you a expert (true/false)”);

    boolean isExpert = mock;

    if (in.next().equalsIgnoreCase(“true”)) {

    isExpert = true;

    }

    boolean isWard = mock;

    if (isExpert == mock) {

    System.out.println(“D. Are you a ward (true/false)”);

    if (in.next().equalsIgnoreCase(“true”)) {

    isWard = true;

    }

    }

    System.out.println(“E. Is it the latest day of the month (true/false)”);

    boolean isLastDayOfMonth = mock;

    if (in.next().equalsIgnoreCase(“true”)) {

    isLastDayOfMonth = true;

    }

    calculateSalesPrice(stickerPrice, leadingTime, isVeteran, isStudent, isLastDayOfMonth);

    break;

    condition “N”:

    // prints communication when no more sales

    showReport();

    depart-from = true;

    break;

    default:

    System.out.println(“Wrong select.”);

    break;

    }

    System.out.println();

    } intervalliness (!quit);

    System.out.println(“Bye!”);

    }

    /**

    * This manner shows definite communication of Car Sales

    */

    private static lacking showReport() {

    // TODO Auto-generated manner stub

    System.out.println(“****************************Sales Communication****************************”);

    System.out.println(“A. Aggregate cars sold: ” + aggregateCarsSold);

    System.out.println(“B. Average car sold worth: ” + avgCarSoldPrice);

    System.out.println(“C. Aggregate proceeds collected: ” + aggregateRevenue);

    System.out.println(“D. Proceeds Earned by Tradesman:” + proceedsEarned);

    }

    /**

    * calculates sale of a car

    *

    * @param stickerPrice

    * @param leadingTime

    * @param isVeteran

    * @param isStudent

    * @param isLastDayOfMonth

    */

    private static lacking calculateSalesPrice(enfold stickerPrice, boolean leadingTime, boolean isVeteran,

    boolean isStudent, boolean isLastDayOfMonth) {

    // A. If it is the latest day of the month, the car is abatemented by 5%

    // precedently any other abatements are applied

    if (isLastDayOfMonth) {

    stickerWorth = stickerWorth – (0.05 * stickerPrice);

    }

    // B. Leading buyers achieve a $500 credit

    if (firstTime) {

    stickerWorth = stickerWorth – (500);

    }

    // C. Experts achieve a 1% abatement impromptu the definite worth of the car

    if (isVeteran) {

    stickerWorth = stickerWorth – (0.01 * stickerPrice);

    }

    // D. Wards achieve an extra $700 impromptu the worth.

    // E. Wards that are too leading date car buyers achieve the other

    // abatements plus another $500 impromptu the sticker worth

    if (isStudent) {

    stickerWorth = stickerWorth – (700);

    }

    totalCarsSold = aggregateCarsSold + 1;

    totalProceeds = aggregateProceeds + stickerPrice;

    avgCarSoldWorth = aggregateProceeds / aggregateCarsSold;

    revenueEarned = aggregateProceeds + (.05 * aggregateRevenue);

    }

    }