Question: CODE IN JAVA PROMPTS: Code the bold from the prompts below in the printf statements that capture data into your program. Once again, the prompts

CODE IN JAVA

PROMPTS: Code the bold from the prompts below in the printf statements that capture data into your program. Once again, the prompts tell you your input variables.

Welcome Message: Prints before prompt for customer name.

1st Prompt:

YEE-TRADE, INC. - The Wild West of Electronic Trading Welcome to Yee-Trade's stock purchase calculator.

What is your name?

2nd Prompt: Beginning with this prompt, the majority of the code will be nested in the for mentioned in 6c above.

Enter your log-in:

3rd Prompt: If the entries from the 2nd and 3rd prompts match the real log-in and password proceed to the 4th prompt else print the error message(s).

Enter your password:

Error Message When Log-In & Password Incorrect: One of these error messages will be displayed every time the log-in or password is incorrect. The 9 represents the number of attempts left out of two (2). Youll accommodate in the code for the possibility of more than 2 attempts.

Invalid log-in or password! 9 attempts left. Use when >= 2 attempts left

Invalid log-in or password! 9 attempt left. Use when 1 attempt left

Error Message When No More Attempts Left: This error message will be displayed when there are no more attempts left, and the program will terminate. This is NOT a forced exit. The code should

automatically sequence to the exit statement at the end of main().

No more attempts left! Contact technical support at 1-800-111-2222.

4th Prompt: This prompt will display after the customer enters the correct log-in and password within the allotted 2 attempts. The value captured from this prompt is the loop-control variable for the sentinel-while loop mentioned in 5a of the Program Instructions section above.

Do you want to calculate your stock purchases? Enter 'Y' or 'N' to exit:

If the answer is anything other than Y, the while loop is by-passed and this message is displayed:

Thank you for using Yee-Trade's stock purchase calculator!

5th Prompt: Prompts 5 through 9 will be in the sentinel-controlled while loop.

How many shares did you purchase?

6th Prompt:

What is the price per share?

7th Prompt: If the answer to this prompt is 'Y' add a 5.95 online trading fee to the stock cost then go to the 9th prompt, else go to the 8th prompt. Also, refer to 5c for additional calculation instructions.

Is this an online trade? Enter 'Y' or 'N':

8th Prompt: This prompt will display only when the answer to the 7th prompt is 'N'. If the answer to this prompt is 'Y', calculate the commission by assessing a 2% brokerage fee on the stock cost then go to the 9th prompt, else proceed to the error message.

Is this a broker assisted trade? Enter 'Y' or 'N':

Error Message When Trade is Neither Online or Broker Assisted: If the answer is 'N', print this error message then proceed to the 9th prompt.

"INVALID TRADE TYPE!"

9th Prompt: If the answer is 'Y' then you'll go back to the 5th prompt. This is the same loop-control variable in prompt 4.

Enter 'Y' for another stock purchase or 'N' to see the cost of your stock purchases:

If the answer is anything other than Y, the while loop is exited, the final output is displayed along with this message:

Thank you for using Yee-Trade's stock purchase calculator!

FINAL OUTPUT SPECIFICATIONS: The Xs in the 3rd header is the customer's name. The Xs in the 4th header is the month name followed by the two 9s for the day and the four 9s for the year. The Zs and 9s represent the output as formatted numbers. Use System.out.printf() and the appropriate format specifiers. NOTE: The final output is only displayed when there are stocks purchased.

YEE-TRADE, INC. TOTAL COST OF STOCK PURCHASES FOR Xxxxxxxxxxxxxxx AS OF XXXXXXXXX 99, 9999

Total Stock Cost: $ZZ,ZZZ,ZZ9.99 Total Online Fees: $Z,ZZZ,ZZ9.99 Total Commissions: $Z,ZZZ,ZZ9.99

3 Header Lines (Titles) of which the first is triple-line advanced (two %n).

Date Label & Date (Title)

4 Total lines for stock cost, online fees, commissions, and the overall TOTAL cost (last line).

TOTAL COST: $ZZZ,ZZZ,ZZ9.99

***END OUTPUT SPECIFICATIONS***

***OUTPUT WITH 2 UNSUCCESSFUL LOG-IN ATTEMPTS*** NOT PART OF OUTPUT YEE-TRADE, INC. - The Wild West of Electronic Trading Welcome to Yee-Trade's stock purchase calculator. What is your name? Hawkeye Pierce

Enter your log-in: Biff2008

Enter your password: Buffy2011

Invalid log-in or password! 1 attempt left.

Enter your log-in: LastChance

Enter your password: BetterWork

No more attempts left! Contact technical support at 1-800-111-2222.

Thank you for using Yee-Trade's stock purchase calculator!

***OUTPUT WITH CORRECT LOG-IN: EXCEPT FOR LOG-IN, AND INPUT VALIDATION, SAME AS PA1*** NOT PART OF OUTPUT

YEE-TRADE, INC. - The Wild West of Electronic Trading Welcome to Yee-Trade's stock purchase calculator. What is your name? Hawkeye Pierce Enter your log-in: Buffett2011

Enter your password: Rank1Bill2008 Invalid log-in or password! 1 attempt left. Enter your log-in: Buffet2011 Enter your password: Rank1Bill2008 Do you want to calculate your stock purchases? Enter 'Y' or 'N' to exit: y How many shares did you purchase? l000

You must only enter an integer for the number of shares: 1000 What is the price per share? 1t

You must only enter a double for the share price: 15 Is this an online trade? Enter 'Y' or 'N': y

Enter 'Y' to calculate the cost of another stock purchase or 'N' to exit: y How many shares did you purchase? 500 What is the price per share? 52 Is this an online trade? Enter 'Y' or 'N': n

Is this a broker assisted trade? Enter 'Y' or 'N': y Enter 'Y' to calculate the cost of another stock purchase or 'N' to exit: y How many shares did you purchase? 50 What is the price per share? 52 Is this an online trade? Enter 'Y' or 'N': n Is this a broker assisted trade? Enter 'Y' or 'N': n INVALID TRADE TYPE! Enter 'Y' to calculate the cost of another stock purchase or 'N' to exit: n

YEE-TRADE, INC. TOTAL COST OF STOCK PURCHASES FOR Hawkeye Pierce AS OF OCTOBER 18, 2018

Total Stock Cost: $41,000.00 Total Online Fees: $5.95 Total Commissions: $520.00

TOTAL COST: $41,525.95 Thank you for using Yee-Trade's stock purchase calculator!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!