Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Create a program that computes annual sales revenue to-date to determinethe status of the company’s sales revenue and whether a year-end bonus is in store for theemployees. Sales revenue is captured...

1 answer below »
Create a program that computes annual sales revenue to-date to determine
the status of the company’s sales revenue and whether a year-end bonus is in store for the
employees. Sales revenue is captured by month within a quarter; therefore, the user can enter as
many quarters as needed as long as the quarters are not less than 1 or greater than 4. If sales
revenue is on target by 50% or more for a sales rep, an encouraging message is sent; otherwise,a warning is sent. If sales revenue to date for the company is greater than or equal to 100% of
projected annual sales, then employees qualify for a 2-5% year-end bonus; otherwise, no yearend bonus can be expected. Use printf() with format specifiers where needed.
Commenting Your Program: Refer to the Java Style Guide posted in Blackboard for more
commenting and formatting details. Java doc comment box examples may have been given to
you in demo programs coded during class or through a video posted by your professor.
a. In your program, YOU MUST insert a program purpose in the first comment box. The
content of that first comment box was shown to you in the Anatomy of a Java Program lecture
for chapter 1.
b. Use Javadoc comment boxes beginning with /** and ending with */ for your comment boxes.
c. Insert a Javadoc comment box above all your methods explaining what is going on with the
code in the method.
d. Line comment the import statements and the variables declared at the class level and/or in any
method [including main()].
e. Line comment close braces. The close brace for an else in an if-else is where you line
comment for the structure. Line comment after the while in a do-while.

**** Attached is my attempt at the code but I can't seems to get it right.
Answered 4 days After Oct 13, 2022

Solution

Huzaifa answered on Oct 17 2022
53 Votes
import java.util.Calendar;
import java.util.Scanner;
import java.util.A
ays;
public class TruongK004PA1
{
private static String report = "TANDEM ENTERPRISES";
private static Scanner input = new Scanner(System.in);
    private static String monthNo = new String();
    private static String salesRep = new String();
    private static String quarter = new String();
    private static double quarterlySales = 0.0;
    private static int qtrCounter = 0;
    private static int noOfQtrs = 0;
    
    
Helper method for checking if input is valid double
    public static boolean isDouble(String value) {
        try {
            Double.parseDouble(value);
            return true;
        } catch (NumberFormatException e) {
            return false;
        }
}
    
    
Helper method for checking if input is valid intege
    public static boolean isInteger(String value) {
        try {
            Integer.parseInt(value);
            return true;
        } catch (NumberFormatException e) {
            return false;
        }
}
    public static void main (String[] args)
{
        double salesRevenue = 0.0;
        double annualSales = 0.0;
        double projectedSales = 0.0;
        double percOfTargetCo = 0.0;
        double percOfTargetRep = 0.0;
        int qtrChoice = 0;
        int monthCounter = 0;
        int noOfMonths = 0;
        int noSalesReps = 0;
        int salesRepCtr = 0;
        
        Calendar dateTime = Calendar.getInstance();
        
System.out.printf("What is the projected annual sales for Tandem?");
        String projectedSale = input.nextLine();
        while(!isDouble(projectedSale)){
            System.out.printf("NOT a valid floating-point! Please re-enter the projected sales for Tandem:");
            projectedSale = input.nextLine();
        }
        projectedSales = Double.parseDouble(projectedSale);
        
System.out.printf("%20.2f",projectedSales);
        
        System.out.printf("How many sales reps work for Tandem?");
        String salesRepNumber = input.nextLine();
        while(!isInteger(salesRepNumber)){
            System.out.printf("NOT a valid integer! Please re-enter the number of sales reps for Tandem:");
            salesRepNumber = input.nextLine();
        }
        noSalesReps = Integer.parseInt(salesRepNumber);
        
System.out.printf("%d",noSalesReps);
        
        do{
            report = "TANDEM ENTERPRISES";
            qtrCounter = 1;
            quarterlySales = 0;
            annualSales = 0;
            salesRepCtr++;
            promptSalesRep(salesRepCtr);
            
System.out.printf("%s",salesRep);
            
            promptNoQtrs();
            
System.out.printf("%d",noOfQtrs);
            report += String.format("%nSALES REVENUE FOR %d QUARTER(S) OF %tY%n", noOfQtrs, dateTime);
            report += String.format("%nSALES REP: %s", salesRep);
            int selectedQtr = 0;
            while(selectedQtr < noOfQtrs){
                monthCounter = 1;
                int chosenquarter = chooseQtr();
                while(monthCounte
4){
                    quarterlySales += promptSalesRevenue(determineMonthNo(monthCounter),...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here