PROGRAM INSTRUCTIONS: 1. Create a program that calculates the cost of intended stock purchases. 2. Work...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
PROGRAM INSTRUCTIONS: 1. Create a program that calculates the cost of intended stock purchases. 2. Work and submit this PA on your own (no partner). 2023 Linda Shepherd 2 3. Commenting Your Program: Refer to the Java Style Guide posted in Canvas for more commenting and formatting details. Java doc comment box examples are given to you in PowerPoint slides and may have been given to you in demo programs coded during class or through a video posted by your professor. TOC a. In your program, YOU MUST insert a program purpose in the first comment box. The content of that first comment box was shown to you in the Anatomy of a Java Program lecture for chapter 1. b. Use Javadoc comment boxes beginning with /** and ending with */ for your comment boxes. c. Insert a Javadoc comment box above all your methods explaining what is going on with the c. Insert a Javadoc comment box above all your methods explaining what is going on with the code in the method. d. Line comment the import statements and the variables declared at the class level and/or in any method [including main()). e. Line comment close braces. The close brace for an else in an if-else is where you line comment for the structure. Line comment after the while in a do-while. 4. Formatting Rules: Always test to validate your program is functioning properly with the correct output and spacing (line advances and spacing after punctuation) in the output. The %n can function differently when using separate printf() statements versus one printf(). 5. UML Class Diagram: Data members are variables. The variables can be derived from the prompts and/or the final output. The complete code for the PA is outlined in logical progression within this UML. Class Name Your Last Name First Initial YourSection NoPA1 Example: ShepherdL001PA1 Class N/A Data Members Method input: Data Scanner dateTime: Calendar Members date, customerName: String shares, noStocks: int sharePrice, stockCost, commission, total Cost, onlineFee, totalStockCost, total Commissions, totalonlineFees: double onlineTrade, brokerAssisted, another: char 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. Except for the first two prompts, all the other ones reside within the while loop. 2023 Linda Shepherd YEE-TRADE, INC. The Wild West of Electronic Trading Welcome to Yee-Trade's stock cost calculator. 4st Drompt: This vira the continalleen centralvariable another before 3 TOC YEE-TRADE, INC. The Wild West of Electronic Trading Welcome to Yee-Trade's stock cost calculator. 1st Prompt: This primes the sentinel-loop control variable another before entering the while that controls the calculation for each stock cost. Enter 'Y' to begin stock cost calculations or 'N' to exit: 2nd Prompt: If another is 'Y' then ask for the customer's name. What is your name? If the answer is anything other than 'Y', the while loop is by-passed along with the remaining prompts, and no final output is displayed other than this message: Thank you for using Yee-Trade's stock purchase calculator! 3rd Prompt: This is the next prompt when the answer to prompt 2 is Y. How many shares do you want to purchase? 4th Prompt: What is the price per share? 5th Prompt: If the answer to this prompt is 'Y' process for the online trading fee then an to the 7th prompt else ao to the 6th prompt. 5th Prompt: If the answer to this prompt is 'Y' process for the online trading fee then go to the 7th prompt, else go to the 6th prompt. Is this an online trade? Enter 'Y' or 'N': 6th Prompt: This prompt will display when the answer to the 5th prompt is anything other than 'Y'. 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 7th 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' to the 5th and 6th prompts, print this error message then proceed to the 7th prompt. "INVALID TRADE TYPE!" 7th Prompt: If the answer is 'Y' then you'll go back to the 3rd prompt. This is the same loop-control variable in prompt 2. Enter 'Y' to calculate the cost for another stock or 'N' to exit: If the answer is anything other than 'Y', the while loop is exited, the final output is displayed if noStocks is greater than 0 then the thank you message is printed: Thank you for using Yee-Trade's stock cost calculator! Sequencing and Logical Control: The following instructions give you the logical order of the code. The nesting of the logical structures and their Java statements are indented. 1. Declare and properly initialize variables. 2. Print the headers (company name and welcome message). 3. Prompt 1. 4. Code Prompt 2 in an if as long as another is 'Y') essage). 5. Use a sentinel-controlled while loop to process multiple stock cost calculations controlled by another as long as it is 'Y'. a. Pre-increment noStocks. b. Prompt 3. c. Prompt 4. d. Calculate the stockCost, totalStockCost, and totalCost using combined assignment operators for the addition. e. Prompt 5. f. If it is an online Trade, assign 5.95 to onlineFee, calculate the totalOnlineFees and totalCost using combined assignment operators for e. Prompt 5. f. If it is an onlineTrade, assign 5.95 to onlineFee, calculate the totalOnlineFees and totalCost using combined assignment operators for the addition. g. Otherwise, i. Prompt 6. ii. If it is a brokerAssisted trade, then calculate the commission, totalComissions, and totalCost using combined assignment operators for the addition. 1) Otherwise, COPY a) print "INVALID TRADE TYPE!". b) pre-decrement noStocks. c) deduct stockCost from totalStockCost and totalCost using combined assignment operators. h. Prompt 7. 6. Print the final output when noStocks is greater than 0. Here is the printf statement with alignment values. Appendix I posted with this PA is a good resource for formatted output. System.out.printf("%n %nYEE-TRADE, INC." + "%n TOTAL COST OF INTENDED STOCK PURCHASES" + "%nFOR %s" 5 + "%nAS OF %s" TOC 1/3 spaces before the format specifiers through commissions. + "%n %n Total Stock Cost: $%,14.2f" + "%n Total Online Fees: %14s" + "%n Total Commissions: %14s" 119 spaces before the format specifier for TOTAL COST. + "%n %nTOTAL COST: $%, 14.2f%n", customerName, date, totalStockCost, String.format("%,.2f", totalOnlineFees), String.format("%,.2f", totalCommissions), totalCost); 7. Print the "Thank you..." message. 8. Zero out noStocks. 9. Exit. 10. 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. 11. You are to generate output from your program according to the instructions in the sample output section. OUTPUT SPECIFICATIONS: The Xs in the 3rd header is the customer's name. The Xs in the der is the month name (all capitalized) followed by the two 9s for the day and the four 9s for r. The Zs and 9s represent the output as formatted numbers. Zs indicate suppression of zeroes. The 9s indicate the printing of a digit even a 0. Use System.out.printf() and the riate format specifiers. NOTE: The final output is only displayed when there are stocks PROGRAM INSTRUCTIONS: 1. Create a program that calculates the cost of intended stock purchases. 2. Work and submit this PA on your own (no partner). 2023 Linda Shepherd 2 3. Commenting Your Program: Refer to the Java Style Guide posted in Canvas for more commenting and formatting details. Java doc comment box examples are given to you in PowerPoint slides and may have been given to you in demo programs coded during class or through a video posted by your professor. TOC a. In your program, YOU MUST insert a program purpose in the first comment box. The content of that first comment box was shown to you in the Anatomy of a Java Program lecture for chapter 1. b. Use Javadoc comment boxes beginning with /** and ending with */ for your comment boxes. c. Insert a Javadoc comment box above all your methods explaining what is going on with the c. Insert a Javadoc comment box above all your methods explaining what is going on with the code in the method. d. Line comment the import statements and the variables declared at the class level and/or in any method [including main()). e. Line comment close braces. The close brace for an else in an if-else is where you line comment for the structure. Line comment after the while in a do-while. 4. Formatting Rules: Always test to validate your program is functioning properly with the correct output and spacing (line advances and spacing after punctuation) in the output. The %n can function differently when using separate printf() statements versus one printf(). 5. UML Class Diagram: Data members are variables. The variables can be derived from the prompts and/or the final output. The complete code for the PA is outlined in logical progression within this UML. Class Name Your Last Name First Initial YourSection NoPA1 Example: ShepherdL001PA1 Class N/A Data Members Method input: Data Scanner dateTime: Calendar Members date, customerName: String shares, noStocks: int sharePrice, stockCost, commission, total Cost, onlineFee, totalStockCost, total Commissions, totalonlineFees: double onlineTrade, brokerAssisted, another: char 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. Except for the first two prompts, all the other ones reside within the while loop. 2023 Linda Shepherd YEE-TRADE, INC. The Wild West of Electronic Trading Welcome to Yee-Trade's stock cost calculator. 4st Drompt: This vira the continalleen centralvariable another before 3 TOC YEE-TRADE, INC. The Wild West of Electronic Trading Welcome to Yee-Trade's stock cost calculator. 1st Prompt: This primes the sentinel-loop control variable another before entering the while that controls the calculation for each stock cost. Enter 'Y' to begin stock cost calculations or 'N' to exit: 2nd Prompt: If another is 'Y' then ask for the customer's name. What is your name? If the answer is anything other than 'Y', the while loop is by-passed along with the remaining prompts, and no final output is displayed other than this message: Thank you for using Yee-Trade's stock purchase calculator! 3rd Prompt: This is the next prompt when the answer to prompt 2 is Y. How many shares do you want to purchase? 4th Prompt: What is the price per share? 5th Prompt: If the answer to this prompt is 'Y' process for the online trading fee then an to the 7th prompt else ao to the 6th prompt. 5th Prompt: If the answer to this prompt is 'Y' process for the online trading fee then go to the 7th prompt, else go to the 6th prompt. Is this an online trade? Enter 'Y' or 'N': 6th Prompt: This prompt will display when the answer to the 5th prompt is anything other than 'Y'. 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 7th 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' to the 5th and 6th prompts, print this error message then proceed to the 7th prompt. "INVALID TRADE TYPE!" 7th Prompt: If the answer is 'Y' then you'll go back to the 3rd prompt. This is the same loop-control variable in prompt 2. Enter 'Y' to calculate the cost for another stock or 'N' to exit: If the answer is anything other than 'Y', the while loop is exited, the final output is displayed if noStocks is greater than 0 then the thank you message is printed: Thank you for using Yee-Trade's stock cost calculator! Sequencing and Logical Control: The following instructions give you the logical order of the code. The nesting of the logical structures and their Java statements are indented. 1. Declare and properly initialize variables. 2. Print the headers (company name and welcome message). 3. Prompt 1. 4. Code Prompt 2 in an if as long as another is 'Y') essage). 5. Use a sentinel-controlled while loop to process multiple stock cost calculations controlled by another as long as it is 'Y'. a. Pre-increment noStocks. b. Prompt 3. c. Prompt 4. d. Calculate the stockCost, totalStockCost, and totalCost using combined assignment operators for the addition. e. Prompt 5. f. If it is an online Trade, assign 5.95 to onlineFee, calculate the totalOnlineFees and totalCost using combined assignment operators for e. Prompt 5. f. If it is an onlineTrade, assign 5.95 to onlineFee, calculate the totalOnlineFees and totalCost using combined assignment operators for the addition. g. Otherwise, i. Prompt 6. ii. If it is a brokerAssisted trade, then calculate the commission, totalComissions, and totalCost using combined assignment operators for the addition. 1) Otherwise, COPY a) print "INVALID TRADE TYPE!". b) pre-decrement noStocks. c) deduct stockCost from totalStockCost and totalCost using combined assignment operators. h. Prompt 7. 6. Print the final output when noStocks is greater than 0. Here is the printf statement with alignment values. Appendix I posted with this PA is a good resource for formatted output. System.out.printf("%n %nYEE-TRADE, INC." + "%n TOTAL COST OF INTENDED STOCK PURCHASES" + "%nFOR %s" 5 + "%nAS OF %s" TOC 1/3 spaces before the format specifiers through commissions. + "%n %n Total Stock Cost: $%,14.2f" + "%n Total Online Fees: %14s" + "%n Total Commissions: %14s" 119 spaces before the format specifier for TOTAL COST. + "%n %nTOTAL COST: $%, 14.2f%n", customerName, date, totalStockCost, String.format("%,.2f", totalOnlineFees), String.format("%,.2f", totalCommissions), totalCost); 7. Print the "Thank you..." message. 8. Zero out noStocks. 9. Exit. 10. 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. 11. You are to generate output from your program according to the instructions in the sample output section. OUTPUT SPECIFICATIONS: The Xs in the 3rd header is the customer's name. The Xs in the der is the month name (all capitalized) followed by the two 9s for the day and the four 9s for r. The Zs and 9s represent the output as formatted numbers. Zs indicate suppression of zeroes. The 9s indicate the printing of a digit even a 0. Use System.out.printf() and the riate format specifiers. NOTE: The final output is only displayed when there are stocks
Expert Answer:
Answer rating: 100% (QA)
Problem Definition You are tasked with creating a Java program to calculate the cost of intended stock purchases for YeeTrade Inc The program should follow specific formatting commenting and inputoutp... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Explain this answer please a. Combining Traditional Methods and High-tech Innovations Western companies do not have adequate access to equivalent workforce. Using a combination of old ways and...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
A schematic diagram of a turbo jet engine is shown below. The incoming air is decelerated in the diffuser from the flight velocity to a negligible velocity relative to the engine. The air is then...
-
Below is the article related to the funding and construction of the SD Padres' ballpark in downtown San Diego. The article below relates to the Padres' decision to incur substantial payoff...
-
The rotation of an lH127I molecule can be pictured as the orbital motion of an H atom at a distance 160 pm from a stationary I atom. (This picture is quite good; to be precise, both atoms rotate...
-
Your marketing research firm is preparing the final written report on a research project commissioned by a major manufacturer of lawn mowers. One objective of the project was to investigate seasonal...
-
The axial flow steam turbine rotor shown in Fig. P12.69 has a blade outer radius \(R_{0}=2.40 \mathrm{ft}\), a blade inner radius \(\mathrm{R}_{i}=\) \(2.00 \mathrm{ft}\), a steam inlet pressure...
-
Poole Company began the 2013 accounting period with $36,000 cash, $80,000 inventory, $70,000 common stock, and $46,000 retained earnings. During the 2013 accounting period, Poole experienced the...
-
1: Why do project managers tend to focus so little time on the Project Closure phase? What are some of the deliverables and processes done in project closure? Does Agile or Hybrid have a formal...
-
What type of web server is sending packet/frame 280 of the capture? 2. What type of HTTP Status Code is the web server in packet/frame 314 sending? Google the error and provide a quote summarizing...
-
Coronado Company is authorized to issue 23800 shares of 7%, $100 par value preferred stock and 1040000 shares of no-par common stock with a stated value of $1 per share. If Coronado issues 11900...
-
Two reinforced concrete buildings A and B are located in a seismic region. It is estimated that an impending earthquake in the region might be strong (S), moderate (M), or weak (W) with probabilities...
-
A risk consultant been asked to calculate holding period returns (HPRS) using different compounding assumptions. Specifically, she is analyzing a bond investment that has grown from $200 to $500 over...
-
Builtrite is considering the purchase of a machine with the following cash flow diagram: year 0 spend $70,000 year 1 $30,000 year 2 $25,000 year 3 $10,000 year 4 $10,000 What is the payback period?
-
You want to buy your dream car which will cost you $5000. If you could invest your entire savings of $3000 at an annual interest of 10%, how long (in years rounded to two decimal places) would you...
-
K Factor f(x) into linear factors given that k is a zero of f(x). f(x)=4x- 7x-21x+18; k = 3 f(x) = (Factor completely.)
-
Write the chemical equation for the formation of HF from the single, isolated H and F atoms. H+F = 2HF Using the table of bond energies determine the AH for the above reaction. Think about the sign...
-
As water moves through the hydrologic cycle, water quality changes are common because of natural phenomena or anthropogenic pollution. Using Figure 11.1, describe how water-quality changes occur...
-
Your supervisor has asked you to research the following situation concerning Owen and Lisa Cordoncillo. Owen and Lisa are brother and sister. In May 2012, Owen and Lisa exchange business pickup...
-
Ann hires a nanny to watch her two children while she works at a local hospital. She pays the 19-year-old nanny $125 per week for 48 weeks during the current year. a. What is the employer's portion...
-
For each of the following cases, indicate the filing status for the taxpayer(s) for 2012 using the following legend: A - Single B - Married, filing a joint return C - Married, filing separate returns...
-
The equity section of Atrio Ltd. showed the following: share premium 6,101, share capitalordinary 925, share capitalpreference 58, retained earnings 7,420, and treasury shares 2,828. (All amounts are...
-
The following equity accounts are in the ledger of Eudaley Group at December 31, 2025. Instructions Prepare the equity section of the statement of financial position at December 31, 2025. Share...
-
Travis Mordica asks, Since share dividends dont change anything, why declare them? What is your answer to Travis?
Study smarter with the SolutionInn App