HI, I NEED HELP WRITING THEFOLLOWING JAVA PROGRAM ! 1. writenon-void (value-retu
ID: 3613538 • Letter: H
Question
HI, I NEED HELP WRITING THEFOLLOWING JAVA PROGRAM !
1. writenon-void (value-returning) methods in Java
2. write voidmethods in Java
3. passprimitive values to void and non-void Java methods
4. use the Scannerclass or JOptionPane class to get user input and produce finalresults.
Last month Joe purchased stock inTexas Instruments. Here are the details of the purchase:
· Joepurchased 1000 shares of stock.
· Joe paid24.86 for each share of stock.
· Joe paidhis stockbroker a 2% commission based on the total price of thestock.
Two weeks later Joe sold thestock. Here are the details of the sale:
· Joe sold1000 shares of stock.
· Joe soldthe stock for 24.32 a share.
· Joe paidhis stockbroker another 2% commission on the amount of money Joereceived from the sale of the stock.
Programspecifications:
· The mainmethod of your program should have four major sections:
1. declaration section where allvariables are declared (follow naming conventions given innotes)
2. section that gets the input fromthe user (use JOptionPane or the Scanner class)
3. section that calls the methodsthat perform the calculations
Ø no calculations should appear in main
Ø method names should be meaningful and follow thesame naming convention as variables
Ø methods are like C++ functions but all of thesemethods should begin with the words public static)
4. section that calls a method thatdisplays the output
Ø amount of money paid for the stock
Ø amount of commission paid to the stockbroker whenthe stock was purchased
Ø amount of money received from the sale of thestock
Ø amount of commission paid to the stockbroker whenthe stock was sold
Ø amount of profit or loss after the sale of the stockand after the commission is paid to the stockbroker
· Thecommission rate should be declared as a final (follow namingconventions).
Second set of data: (you will need to change the value of the final)
Last month Jane purchased stock inGoogle. Here are the details of the purchase:
· Janepurchased 500 shares of stock.
· Jane paid461.30 for each share of stock.
· Jane paidhis stockbroker a 1 ½ % commission based on the total priceof the stock.
Two weeks later Joe sold the stock. Here are the details of the sale:
· Jane sold500 shares of stock.
· Jane soldthe stock for 465.01 a share.
· Jane paidhis stockbroker another 1 ½ % commission on the amount ofmoney Joe received from the sale of the stock.
THANKS