Question

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

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

*/

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Hi I have changed alot of things in your program. Even the structure also, Its giving same output. But I have not changed textual information, as you asked for the same output. You can change question text also if you want. Below is your program: -

/**

* @(#)

* @author

* @version 1.00 6/25/2017 3:00 PM

* 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 Assign1 {

private static double profMargin = 0.0;

private static double annSales = 0.0;

private static double projSales = 0.0;

private static int noOfQtrs = 0;

public static int getProjSales(Scanner keyboard) {

System.out.printf("%nWhat is the projected annual sales?");// Prompt for

// projected

// sales.

return keyboard.nextInt();

}

public static int getNoOfQuarters(Scanner keyboard) {

System.out.printf("%nEnter the number of quarters (no less than 1 or greater than 4): ");// Prompt

// for

// qrtr

return keyboard.nextInt();

}

public static double getSalesRev(Scanner keyboard, String monNo, int qrtrCount) {

System.out.printf("%nEnter the sales revenue for the %s month of quarter %d: ", monNo, qrtrCount);

return keyboard.nextDouble();

}

public static String createReport() {

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

String rep = "TANDEM ENTERPRISES";

double salesRevenue = 0.0;

double quarterSal = 0.0;

String monNo = "";

int monCount = 1;

int qrtrCount = 1;

int noOfMonths = 3;

String qrtrNo = "";

Scanner keyboard = new Scanner(System.in);// keyboard Scanner

projSales = getProjSales(keyboard);

projSales = projSales / 4;

noOfQtrs = getNoOfQuarters(keyboard);

rep += String.format("%nSALES REVENUE FOR %d QUARTER(S) OF %tY%n", noOfQtrs, dateNow);

do {

quarterSal = 0;

monCount = 1;

System.out.println();

for (monCount = 1; monCount <= noOfMonths; monCount++) {

if (monCount == 1) {

monNo = "1st";

} // End if 1st month

else if (monCount == 2) {

monNo = "2nd";

} // End if 2nd month

else if (monCount == 3) {

monNo = "3rd";

} // End if 3rd month

salesRevenue = getSalesRev(keyboard, monNo, qrtrCount);

quarterSal = quarterSal + salesRevenue;

} // END FOR LOOP

switch (qrtrCount) {

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")

rep += String.format("%n%s Quarter Sales: $%,19.2f", qrtrNo, quarterSal);// 1st quarter

else

rep += String.format("%n%s Quarter Sales: $%,20.2f", qrtrNo, quarterSal);

annSales += quarterSal;

qrtrCount++;

} while (qrtrCount <= noOfQtrs);// End DO WHILE

rep += String.format("%n%nTotal Year-To-Date: $%,19.2f%n", annSales);

return rep;

}

public static void main(String[] args) {

String fullReport = createReport();

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

profMargin = (annSales / projSales * noOfQtrs) * 100;

if (noOfQtrs < 4) {

if (profMargin >= 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 (profMargin >= 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 profMargin>=20

}// End MAIN

}// END CLASS

Sample Output: -


What is the projected annual sales?504000

Enter the number of quarters (no less than 1 or greater than 4): 4


Enter the sales revenue for the 1st month of quarter 1: 25000

Enter the sales revenue for the 2nd month of quarter 1: 1000000

Enter the sales revenue for the 3rd month of quarter 1: 240000


Enter the sales revenue for the 1st month of quarter 2: 23330

Enter the sales revenue for the 2nd month of quarter 2: 23420

Enter the sales revenue for the 3rd month of quarter 2: 33402


Enter the sales revenue for the 1st month of quarter 3: 30430

Enter the sales revenue for the 2nd month of quarter 3: 344022

Enter the sales revenue for the 3rd month of quarter 3: 343023


Enter the sales revenue for the 1st month of quarter 4: 340343

Enter the sales revenue for the 2nd month of quarter 4: 32323

Enter the sales revenue for the 3rd month of quarter 4: 32323
TANDEM ENTERPRISES
SALES REVENUE FOR 4 QUARTER(S) OF 2017

1st Quarter Sales: $ 1,265,000.00
2nd Quarter Sales: $ 80,152.00
3rd Quarter Sales: $ 717,475.00
4th Quarter Sales: $ 404,989.00

Total Year-To-Date: $ 2,467,616.00

Its been a GOOD year. Thank you for all your hard work!

Employees qualify for a 5% year-end bonus!!!

Add a comment
Know the answer?
Add Answer to:
Please help me edit my code so it looks a little different but produces the same...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Java - Car Dealership Hey, so i am having a little trouble with my code, so...

    Java - Car Dealership Hey, so i am having a little trouble with my code, so in my dealer class each of the setName for the salesman have errors and im not sure why. Any and all help is greatly appreciated. package app5; import java.util.Scanner; class Salesman { private int ID; private String name; private double commRate; private double totalComm; private int numberOfSales; } class Car { static int count = 0; public String year; public String model; public String...

  • Question: Please help me to correct answer , I don't understand. This is my last chance....

    Question: Please help me to correct answer , I don't understand. This is my last chance. please help me. 1s... Please help me to correct answer , I don't understand. This is my last chance. please help me. 1st pic: qustion 2nd pic: professor said that fix it. (NEED HELP) 3rd pic: what I answered... please help me. Thank you so so s os o much!!! I am not sure what teacher wants me to put separate....... please help me.(...

  • By editing the code below to include composition, enums, toString; must do the following: Prompt the...

    By editing the code below to include composition, enums, toString; must do the following: Prompt the user to enter their birth date and hire date (see Fig. 8.7, 8.8 and 8.9 examples) in addition to the previous user input Create a new class that validates the dates that are input (can copy date class from the book) Incorporate composition into your class with these dates Use enums to identify the employee status as fulltime (40 or more hours worked for...

  • Below is my code please help me edit it so in the beginning it ask for Press any key to start Tas...

    below is my code please help me edit it so in the beginning it ask for Press any key to start Task n, where n is the task number (1, 2, or 3,4). I already wrote the code for the 4 task. Also please write it so when 1 code is finish running it return to the prompt where it ask to run another task #task 1 list1 = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','.',',','?'] morse = ['.-','-...','-.-.','-..','.','..-.','--.','....','..','.---','-.-','.-..','--','-.','---','.--.','--.-','.-.','...','-','..-','...-','.--','-..-','-.--','--..','-----','.----','..---','...--','....-','.....','-....','--...','---..','----.','.-.-.-','--..--','..--..'] inp = input("Enter original text : ")...

  • Please help!! The Diesel Dynamo Company is a high-tech diesel subsystem production business that produces technology...

    Please help!! The Diesel Dynamo Company is a high-tech diesel subsystem production business that produces technology accessories for trucks and other transport. The design of Diesel Dynamo products are unique and represent a breakthrough in the industry. The units Diesel Dynamo produces claim to provide for greater dependability, quality and longevity. The company is completing its third year of operations and is preparing to create a master budget for next year, 2017. The budget will detail each quarter’s activities and...

  • Just need help with tying out summary cash budget to $107,750 for 3rd quarter (check figure) Cost...

    Just need help with tying out summary cash budget to $107,750 for 3rd quarter (check figure) Cost Accounting Master Budget Project Walter Bond, president of Denmark Company, was just concluding a budget meeting with his senior staff. It was November of 20x0, and the group was discussing preparation of the firm’s master budget for 20x1. “I’ve decided to go ahead and purchase the industrial robot we’ve been talking about. We’ll make the acquisition on January 2 of next year, and...

  • could you please help me with this problem, also I need a little text so I...

    could you please help me with this problem, also I need a little text so I can understand how you solved the problem? import java.io.File; import java.util.Scanner; /** * This program lists the files in a directory specified by * the user. The user is asked to type in a directory name. * If the name entered by the user is not a directory, a * message is printed and the program ends. */ public class DirectoryList { public static...

  • In the processLineOfData method, write the code to handle case "H" of the switch statement such...

    In the processLineOfData method, write the code to handle case "H" of the switch statement such that: • An HourlyEmployee object is created using the firstName, lastName, rate, and hours local variables. Notice that rate and hours need to be converted from String to double. You may use parseDouble method of the Double class as follows: Double.parseDouble(rate) Call the parsePaychecks method in this class passing the Hourly Employee object created in the previous step and the checks variable. Call the...

  • Can somebody help me with my accounting project, here are the instructions: Financial Analysis Project Project...

    Can somebody help me with my accounting project, here are the instructions: Financial Analysis Project Project Requirements and Instructions Sheet Objective In accordance with the Knowledge, Skills and Abilities objectives of the course, you are required to evaluate the financial performance of a publicly traded US Corporation and write a 10 page (excluding appendix and other supporting documents) report on your findings. This event will help participants develop the ability to understand, analyze, and make decisions based on financial information—these...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT