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

Please help me edit my code so it looks a little different but produces the same

ID: 3856604 • Letter: P

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 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 company’s

* 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!!!>

*/

Explanation / Answer

Here is the modified code with output. Used the same formula for calculating profit margin. Hope its correct :-)

/**

* @(#)

* @author

* @version 1.00

* Program Purpose: Code a program that computes 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.

*/

import java.util.*;

public class BonusCalculator {

   public static void main(String[] args) {

       Scanner keybd = new Scanner(System.in); // to get input from keyboard

       double projAnnualSales = 0.0;

       int numQtrs = 0;

       // Prompt for projected sales.

       System.out.printf(" What is the projected annual sales? ");

       projAnnualSales = keybd.nextInt();

       // prompt for number of quarters;

       System.out.printf(" How many quarters [1-4]? ");

       numQtrs = keybd.nextInt();

      

       double monthlySales = 0.0;

       double quarterlySales = 0.0;

       double projQuaterlySales = projAnnualSales / 4;

       double annualSales = 0.0;

       double profitMargin = 0.0;

       String suffix = "";

       Calendar dateTime = Calendar.getInstance();// Get from Calender

       String report = " TANDEM ENTERPRISES";

       report += String.format(" SALES REVENUE FOR %d QUARTER(S) OF %tY%n", numQtrs, dateTime);

       System.out.println(" Enter the sales details for different quarters -");

       for (int qtr = 1; qtr <= numQtrs; qtr++) {

           quarterlySales = 0;

           System.out.printf(" Quarter %d: ", qtr);

           for (int month = 1; month <= 3; month++) {

               if (month == 1)

                   suffix = "st";

               else if (month == 2)

                   suffix = "nd";

               else if (month == 3)

                   suffix = "rd";

               System.out.printf(" %d%s Month : ", month, suffix);

               monthlySales = keybd.nextDouble();

               quarterlySales = quarterlySales + monthlySales;

           } // END FOR LOOP

           if (qtr == 1)

               suffix = "st";

           else if (qtr == 2)

               suffix = "nd";

           else if (qtr == 3)

               suffix = "rd";

           else if (qtr == 3)

               suffix = "th";

          

             

           report += String.format(" %d%s Quarter Sales : %20s", qtr, suffix, String.format("$%,.2f", quarterlySales));

           annualSales += quarterlySales;

      

       } //END FOR LOOP  

  

       report += String.format(" Total Year-To-Date : %20s", String.format("$%,.2f", annualSales));

       System.out.printf("%s", report);

       double expectedSales = projQuaterlySales * numQtrs;

      

       profitMargin = (annualSales/projQuaterlySales * numQtrs) * 100;

       if (profitMargin >= 20)

       {

           if(numQtrs < 4)

               System.out.printf(" Keep up the GOOD work and a possible year-end bonus!");

           else

               System.out.printf(" Its been a GOOD year. Thank you for all your hard work! "

                       + " Employees qualify for a 5%% year-end bonus!!!");

       }

       else

       {

           if(numQtrs < 4)

               System.out.printf(" So far sales are lagging behind projections");

       }

   }// End MAIN

}// END CLASS

output

What is the projected annual sales? 250000

How many quarters [1-4]? 2

Enter the sales details for different quarters -

Quarter 1:

   1st Month : 23000

   2nd Month : 12000

   3rd Month : 15000

Quarter 2:

   1st Month : 25000

   2nd Month : 30000

   3rd Month : 40000

TANDEM ENTERPRISES

SALES REVENUE FOR 2 QUARTER(S) OF 2017

1st Quarter Sales : $50,000.00

2nd Quarter Sales : $95,000.00

Total Year-To-Date : $145,000.00

Keep up the GOOD work and a possible year-end bonus!

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