Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Urgent!!! Please use java thank you in advance Create a program that computes annual sales revenue to-date to determine the status of the companys sales

Urgent!!! Please use java thank you in advance

Create a program that computes annual 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. 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.

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" ; 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.

Prompt 1

Prompt 2

Do

Assign 1 to qtrCounter

Reinitialize quarterlySales to default value

Post-increment salesRepCtr

Prompt 3

Prompt 4

while qtrCounter <= noOfQtrs

Assign 1 to monthCounter

Prompt 5

Assign First Quarter through Fourth Quarter to quarter using a ternary

operation (actual code given in PA instructions)

while monthCounter <= noOfMonths

if monthCounter =1

monthNo = 1st

else if monthCounter = 2

monthNo = 2nd

else in monthCounter = 3

monthNo = 3rd

endIfElseIf

Prompt 6

quarterlySales = quarterlySales + salesRevenue (use combined assignment per instructions meaning +=.)

Pre-increment monthCounter

endWhile monthCounter <= noOfMonths

annualSales = annualSales + quarterlySales (use combined assignment per instructions meaning +=.)

Pre-increment qtrCounter

endWhile qtrCounter <= noOfQtrs

Print 1

percofTargetRep = quarterlySales / (projectedSales/noSalesReps) * 100

if noOfQtrs < 4

if percOfTargetRep >=50

Print 2

else

Print 3

endIF

while salesRepCtr < noSalesReps //end of do-while

percOfTargetCo = (annualSales/projectedSales) * 100

Print 4

if percOfTargetCo >= 100

Print 5

else

Print 6

endIf

Stop

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Systems A 360-degree Approach

Authors: Jawwad ShamsiMuhammad Khojaye

1st Edition

0429531575, 9780429531576

Students also viewed these Databases questions