Question: I need help writing this program. It is described in the 2 attached pages. If I see how someone does it correctly, it will help

I need help writing this program. It is described in the 2 attached pages. If I see how someone does it correctly, it will help me immensely going through and seeing the things I did wrong. Also, any helpful suggestions/explanations would be great!! Thank you so much!!  I need help writing this program. It is described in the
2 attached pages. If I see how someone does it correctly, it

Home Age: Syrace - Modele 2 MC 2001 1. Write a program named, StockTransaction.java, according to the following requirements: Your program will ask the user for the initial stock price, and then the selling price of the stock. The initial stock price is what Joe paid when he initially bought the stock. The selling price of the stock is what Joes receives per share when he Sells the stock. Your program should assume that the inputs are valid, that is, Last month Joe purchased stock in Acme Software, Inc. Here are the purchase details: Joe purchased 1,000 shares . Joe paid the initial stock price (the program's first input) for each share of stock he purchased Joe's stockbroker was paid a commission that amounted to 2% of the amount Joe paid for the stock Two weeks later Joe sold the stock. Here are the details of Joe's stock sale: Joe sold all 1,000 shares of the stock . Joe sold the stock for the selling price of the stock (the program's second input) Joe paid his stockbroker another commission that amounted to 2% of the amount he received for the stock After prompting for and reading the two values for the stock prices (both type, double), your program must display the following information: The total amount Joe paid for the stock in his initial purchase The amount of commission Joe paid his broker when he bought the stock . The total amount that Joe sold the stock for . Finally, the amount of profit that Joe made after the selling the stock and paying the two commissions to his broker. Note that if the amount of profit displayed is negative the Joe lost money on the transaction. Your program just displays value; your program does not make a 1 CA Programming Awigament Sequence - Module 2 MCB SPRING-CSCHIAR 32518 decision about whether Joe earned or lost money -- decisions in code will be covered in the next module. con Here are two examples of your program running. These examples are exactly what your program should look like when it executes, except that the inputs can be any valid double values. Here is the first example: Enter the initial stock price per share: 32.87 Enter the selling stock price per share: 33.92 Joe paid $32870.0 for the stock. Joe paid a broker commission of $657.4 on the purchase. So, Joe paid a total of $33527.4 4 Joe sold the stock for $33920.0 5 Joe paid a broker commission of $678.4 on the sale. 6 So, Joe recieved a total of $33241.6 7 Joe's profit or loss: $-285.8800000000029 Here is the second example: Enter the initial stock price per share: 29.53 Enter the selling stock price per share: 42.97 Joe paid $29530.0 for the stock. Joe paid a broker commission of $590.6 on the purchase. So, Joe paid a total of $30120.6 Joe sold the stock for $42970. Joe paid a broker commission of $859.4 on the sale. So, Joe recieved a total of $42110.6 F a fil s! dc Joe's profit or loss: $11990.0 The numbers in red above are the user's inputs during each execution. These are shown in red to help make the example clearer; you do not print anything in red. Also, you should try other values besides the ones shown. The assumption is that all inputs are always positive. Finally, Chapter 2 (section 2.8) presented the use of named constants. These should be used in EVERY program you when whenever the requirements contain or imply numeric values. The Stock Transaction to 3

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!