Question
Please help me edit my code so it looks a little different but produces the same output. Me and classmate did the assignment correctly but
Please help me edit my code so it looks a little different but produces the same output. Me and classmate did the assignment correctly but are afraid of plagarism.
Here is my code.
/**
* @(#)
* @author
* @version 1.00 6/25/2017 3:00 PM
* Program Purpose: Code a program that computes sales revenue
* to-date to determine the status of the companys
* sales revenue and whether a year end bonus is in store for the employees.
*/
import java.util.*;
public class
{
public static void main(String[]args)
{
Calendar dateTime = Calendar.getInstance();//Get from Calender
Scanner input = new Scanner(System.in);//input Scanner
String monthNo = "";
String report = "TANDEM ENTERPRISES";
double salesRevenue = 0.0;
double quarterlySales = 0.0;
double annualSales = 0.0;
double projectedSales = 0.0;
double profitMargin = 0.0;
int monthCounter = 1;
int qrtrCounter = 1;
int noOfQtrs = 0;
int noOfMonths = 3;
String qrtrNo = "";
System.out.printf("%nWhat is the projected annual sales?");//Prompt for projected sales.
projectedSales = input.nextInt();
projectedSales = projectedSales/4;
System.out.printf("%nEnter the number of quarters (no less than 1 or greater than 4): ");//Prompt for qrtr
noOfQtrs = input.nextInt();
report += String.format("%nSALES REVENUE FOR %d QUARTER(S) OF %tY%n"
,noOfQtrs, dateTime);
do
{
quarterlySales = 0;
monthCounter = 1;
System.out.println();
for(monthCounter = 1; monthCounter<=noOfMonths; monthCounter++)
{
if(monthCounter == 1)
{
monthNo = "1st";
}//End if 1st month
else if(monthCounter == 2)
{
monthNo = "2nd";
}//End if 2nd month
else if(monthCounter == 3)
{
monthNo = "3rd";
}//End if 3rd month
System.out.printf("%nEnter the sales revenue for the %s month of quarter %d: ", monthNo, qrtrCounter);
salesRevenue = input.nextDouble();
quarterlySales = quarterlySales + salesRevenue;
}//END FOR LOOP
switch(qrtrCounter)
{
case 1:
qrtrNo = "1st";
break;
case 2:
qrtrNo = "2nd";
break;
case 3:
qrtrNo = "3rd";
break;
case 4:
qrtrNo = "4th";
break;
}//End switch statement
if (qrtrNo == "1st")
report += String.format("%n%s Quarter Sales: $%,19.2f", qrtrNo, quarterlySales);//when its 1st quarter
else
report += String.format("%n%s Quarter Sales: $%,20.2f", qrtrNo, quarterlySales);
annualSales += quarterlySales;
qrtrCounter ++;
}while(qrtrCounter<=noOfQtrs);//End DO WHILE
report += String.format("%n%nTotal Year-To-Date: $%,19.2f%n", annualSales);
System.out.printf("%s", report);
profitMargin = (annualSales/projectedSales * noOfQtrs) * 100;
if(noOfQtrs<4)
{
if(profitMargin>=20)
System.out.printf("%nKeep up the GOOD work and a possible year-end bonus!");
else
System.out.printf("%nSo far sales are lagging behind projections");
}//END IF noOfQrtrs<4
else
{
if(profitMargin>=20)
System.out.printf("%nIts been a GOOD year. Thank you for all your hard work!%n" +
"%nEmployees qualify for a 5%% year-end bonus!!!");
}//End IF profitMargin>=20
//System.exit(50);
}//End MAIN
}//END CLASS
And this is what the output should be
****OUTPUT***
/**TANDEM ENTERPRISES
SALES REVENUE FOR 1 QUARTER(S) OF 2017
1st Quarter Sales: $ 250,000.00
Total Year-To-Date: $ 250,000.00
Keep up the GOOD work and a possible year-end bonus!
TANDEM ENTERPRISES
SALES REVENUE FOR 1 QUARTER(S) OF 2017
1st Quarter Sales: $ 16,000.00
Total Year-To-Date: $ 16,000.00
So far sales are lagging behind projections>
TANDEM ENTERPRISES
SALES REVENUE FOR 4 QUARTER(S) OF 2017
1st Quarter Sales: $ 126,000.00
2nd Quarter Sales: $ 126,000.00
3rd Quarter Sales: $ 126,000.00
4th Quarter Sales: $ 126,000.00
Total Year-To-Date: $ 504,000.00
Its been a GOOD year. Thank you for all your hard work!
Employees qualify for a 5% year-end bonus!!!>
*/
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started