1. 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...

1. 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 year-end bonus can be
expected. Use printf() with format specifiers where needed.
2. Work and submit this PA on your own (no partner).
3. UML Diagrams for the class: Data members are variables. The variables can be derived from
the prompts and/or the output. The complete code for the PA is outlined in logical progression
within this UML.
Class Name YourLastNameFirstInitialYourSectionNoPA1 ShepherdL001PA1
Class
Data
Members
N/A
Method
Data
Members
input: Scanner
dateTime: Calendar
salesRep, monthNo, quarter: String
salesRevenue, quarterlySales, annualSales, projectedSales,
percOfTargetCo, perceOfTargetRep: double
qtrChoice, monthCounter, qtrCounter, noOfQtrs, noOfMonths,
noSalesReps, salesRepCtr: int
Methods +main(args: String[]): static void
PROMPTS: Code what is in bold from the prompts below in printf()
statements for capturing data. The actual output is not in bold. The prompts
tell you your input variables.
TOC
© 2022 Linda Shepherd 3
1st Prompt:
What is the projected annual sales for Tandem?
2nd Prompt:
How many sales reps work for Tandem?
3rd Prompt:
Enter the name of a sales rep:
OR
Enter the name of the next sales rep:
Use this ternary in a printf() to determine which prompt is used by inserting the
words to put in %s based on the value in salesRepCtr.
"%nEnter the name of %s sales rep: ", salesRepCtr == 1 ? "a" : "the next"
4th Prompt:
Enter the number of quarters worked (no less than 1 or greater than 4):
5th Prompt:
1. First Quarter
2. Second Quarter
3. Third Quarter
4. Fourth Quarter
Choose the quarter in which sales were earned:
OR
Choose the next quarter in which sales were earned:
Insert this code as the last concatenated line in the printf() for Prompt 5. The
argument is a ternary that decides to put “next ” or nothing in the %s. Note
there is a space after the word next in the String literal. There is no space inbetween the double quotes.
"%n%nChoose the %squarter in which sales were earned: ",

qtrCounter > 1 ? "next " : ""
Right after the printf(), code the following ternary to setup for Prompt 6. The
ternary is a shortened if-else-if.
quarter = (qtrChoice == 1) ? "First Quarter" : (qtrChoice == 2) ?
"Second Quarter" : (qtrChoice == 3) ? "Third Quarter" : "Fourth Quarter";
TOC
© 2022 Linda Shepherd 4
6th Prompt:
Enter the sales revenue for the Xxx month of the Xxxxxx Xxxxxxx:
where Xxx holds 1st, 2nd, or 3rd and Xx Xxxxxx holds First Quarter, Second
Quarter, Third Quarter, Fourth Quarter.
Sequencing and Logical Control Structures:
1. Prompts 1 and 2 are code before the do-while loop which controls the
sales reps.
2. Within the do-while loop:
a. Reinitialize qtrCounter to 1.
b. Zero out quarterlySales.
c. Post-increment salesRepCtr.
d. Prompt 3.
c. Prompt 4.
d. Nested while loop controls the number of quarters.
i. Initialize monthCounter to 1.
ii. Prompt 5 and code for the content of the quarter variable.
iii. Nested, nested while loop controls the number of months within a
quarter.
1) Use if-else-if to assign “1st”, “2nd”, “3rd” to monthNo based on
monthCounter.
2) Prompt 6.
3) Use combined assignment operator to add salesRevenue to
quarterlySales.
4) Pre-increment monthCounter.
d. Use combined assignment operator to add quarterlySales to
annualSales.
e. Pre-increment qtrCounter.
f. Print output for sales rep.
g. Calculate the percOfTargetRep which determines whether the sales
rep is on target for their portion of the projected sales.
h. if the noOfQtrs is less than 4
i. Test if percOfTargetRep is greater than or equal to 50, if so print
TOC
© 2022 Linda Shepherd 5
where the substring() grabs the first name.
"%nKeep up the GOOD work, %s. There is a "

+ "possible year-end bonus!%n", salesRep.substring(0, salesRep.indexOf(' '))
There is a space between the single quotes.
ii. Otherwise, print:
So far sales are lagging behind projections.
3. Calculate the percOfTargetCo.
4. Print:
CORPORATE SALES PERFORMANCE
a. If percOfTargetCo is greater than or equal to 100, print exactly as
seen using the proper line advancing.
It's been a GOOD year so far. There could be a year-end bonus of
about 2-5% if we can keep on top of our sales goals. Thank you all
and please continue your excellent effort!
b. Otherwise, print the following all on the same line, no word wrap.
Sales are lagging projections. A year-end bonus may not be
possible.
5. Exit.
6. The Prompts, the output specs, and the sample output show you in what
order to place your code. To return from these links press Alt, left arrow.
7. You are to generate output from your program according to the instructions
in the sample output section.
SALES REP OUTPUT SPECIFICATIONS: The Zs and 9s represent the output as formatted
numbers. Zs indicate zero-suppression of leading numbers. 9s represent numbers printed as digits
from 0-9. Xs are text. Zs, 9s, Xs are values that will change, everything else are headers, titles, and
labels. Use System.out.printf() and the appropriate format specifiers to properly format the output.
The year is NOT to be hard coded into the header, instead, you will capture the system's date and
format for the year only (refer to Appendix I). This is so the year corresponds to when the program is
run. What is printed is for each sales rep.
TANDEM ENTERPRISES
SALES REVENUE FOR 9 QUARTER(S) OF 9999
SALES REP: Xxxxxxxxxxxx Xxxxxxxxxxxxxxxxxxxx
Total Year-To-Date: $ZZZ,ZZZ,ZZ9.99
***END SALES REP OUTPUT SPECIFICATIONS***
Header (Title). Triple line advance uses 2 %n’s with 2nd
and 3rd lines of the header using 1 %n.
Total Label with year-to-date sales figure which tells you
your output variable. When printed, the $ sign will not
float to the leading digit.
TOC
© 2022 Linda Shepherd 6
FINAL OUTPUT SPECIFICATIONS: Printed after the last sales rep.
CORPORATE SALES PERFORMANCE
It's been a GOOD year so far. There could be a year-end bonus of
about 2-5% if we can keep on top of our sales goals. Thank you all
and please continue your excellent effort!
OR
Sales are lagging projections. A year-end bonus may not be possible.
***END FINAL OUTPUT SPECIFICATIONS***
SUBMISSIONS REQUIREMENT:
1. Plan: Upload your plan to Blackboard under this PA.
2. Word Document: Copy your .java code into a Word document and save it with the same name
as your program. Upload the document to Blackboard under this PA.
3. Zipping Folders: Your Java files “must be” in a folder.
a. Create a folder named for the program (excluding the file extension).
b. Put your .java, .class, .java~ files in the folder. You must have all 3 files.
c. Put your completed PA1 plan Word document in the folder.
d. To zip the folder, point to it then right click and
i. Filzip if you have it OR
ii. Click Send To then click Compressed (zipped) Folder
e. Upload your zipped folder to Blackboard under this PA.
4. Uploading to Blackboard: Make sure your browser is properly configured for Blackboard
(see syllabus).
a. Your submissions are to be uploaded to Blackboard through Assignments only.
b. Upload your files no later than the due date by 11:55 pm; otherwise, you don’t have time to
recover from any problems and your assignment may not be accepted by Blackboard.
c. Check to make sure your submission is uploaded. Please do not ask your instructor to
check whether your assignment has been uploaded. You can do this yourself. Or upload
during a tutoring session when someone can help you.
d. If you submit your assignment before the due date, want to make changes or upload additional
files, you can re-upload your files.
5. NO ASSIGNMENTS WILL BE ACCEPTED LATE OR VIA E-MAIL. DO NOT UPLOAD
PROGRAMS THAT DON’T COMPILE OR DON’T PRODUCE CORRECT OUTPUT.
SAMPLE OUTPUT: It is always good to test your code using sample data to see if your program
meets the output specifications. Run your program using the data in the following sample
output. Copy and paste the output into a comment box at the end of your PA1.java file. The
comment box needs to be outside of the close brace for the class. Change your font in DrJava to
TOC
© 2022 Linda Shepherd 7
Monospaced or Courier New if your output is out of alignment. Worth 5 points! Your output
will not print in bold. The TOC in the top right-hand corner of the page is not part of the output. It
takes you to the table of contents on page 1.
***SALES NOT ON TRACK***  Not part of output.
What is the projected annual sales for Tandem? 500000
How many sales reps work for Tandem? 2
Enter the name of a sales rep: Julian Caesar
Enter the number of quarters worked (no less than 1 or greater than 4): 1
1. First Quarter
2. Second Quarter
3. Third Quarter
4. Fourth Quarter
Choose the quarter in which sales were earned: 2
Enter the sales revenue for the 1st month of the Second Quarter: 100000
Enter the sales revenue for the 2nd month of the Second Quarter: 50000
Enter the sales revenue for the 3rd month of the Second Quarter: 100000
TANDEM ENTERPRISES
SALES REVENUE FOR 1 QUARTER(S) OF 2022
SALES REP: Julian Caesar
Total Year-To-Date: $ 250,000.00
Keep up the GOOD work, Julian. There is a possible year-end bonus!
Enter the name of the next sales rep: Monique La Femme
Enter the number of quarters worked (no less than 1 or greater than 4): 2
1. First Quarter
2. Second Quarter
3. Third Quarter
4. Fourth Quarter
Choose the quarter in which sales were earned: 1
Enter the sales revenue for the 1st month of the First Quarter: 5000
Enter the sales revenue for the 2nd month of the First Quarter: 6000
TOC
© 2022 Linda Shepherd 8
Enter the sales revenue for the 3rd month of the First Quarter: 5000
1. First Quarter
2. Second Quarter
3. Third Quarter
4. Fourth Quarter
Choose the next quarter in which sales were earned: 2
Enter the sales revenue for the 1st month of the Second Quarter: 5000
Enter the sales revenue for the 2nd month of the Second Quarter: 6000
Enter the sales revenue for the 3rd month of the Second Quarter: 5000
TANDEM ENTERPRISES
SALES REVENUE FOR 2 QUARTER(S) OF 2022
SALES REP: Monique La Femme
Total Year-To-Date: $ 32,000.00
So far sales are lagging behind projections.
CORPORATE SALES PERFORMANCE
Sales are lagging projections. A year-end bonus may not be possible.
***SALES MET OR EXCEEDED*** Not part of output.
What is the projected annual sales for Tandem? 500000
How many sales reps work for Tandem? 2
Enter the name of a sales rep: Julian Caesar
Enter the number of quarters worked (no less than 1 or greater than 4): 1
1. First Quarter
2. Second Quarter
3. Third Quarter
4. Fourth Quarter
Choose the quarter in which sales were earned: 2
Enter the sales revenue for the 1st month of the Second Quarter: 100000
Enter the sales revenue for the 2nd month of the Second Quarter: 50000
Enter the sales revenue for the 3rd month of the Second Quarter: 100000
TOC
© 2022 Linda Shepherd 9
TANDEM ENTERPRISES
SALES REVENUE FOR 1 QUARTER(S) OF 2022
SALES REP: Julian Caesar
Total Year-To-Date: $ 250,000.00
Keep up the GOOD work, Julian. There is a possible year-end bonus!
Enter the name of the next sales rep: Monique La Femme
Enter the number of quarters worked (no less than 1 or greater than 4): 2
1. First Quarter
2. Second Quarter
3. Third Quarter
4. Fourth Quarter
Choose the quarter in which sales were earned: 1
Enter the sales revenue for the 1st month of the First Quarter: 25000
Enter the sales revenue for the 2nd month of the First Quarter: 75000
Enter the sales revenue for the 3rd month of the First Quarter: 25000
1. First Quarter
2. Second Quarter
3. Third Quarter
4. Fourth Quarter
Choose the next quarter in which sales were earned: 2
Enter the sales revenue for the 1st month of the Second Quarter: 10000
Enter the sales revenue for the 2nd month of the Second Quarter: 25000
Enter the sales revenue for the 3rd month of the Second Quarter: 30000
TANDEM ENTERPRISES
SALES REVENUE FOR 2 QUARTER(S) OF 2022
SALES REP: Monique La Femme
Total Year-To-Date: $ 190,000.00
Keep up the GOOD work, Monique. There is a possible year-end bonus!
CORPORATE SALES PERFORMANCE
TOC
© 2022 Linda Shepherd 10
It's been a GOOD year so far. There could be a year-end bonus of
about 2-5% if we can keep on top of our sales goals. Thank you all
and please continue your excellent effort!
Oct 01, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here