Question: Compute Java ProgramRay Shimlock bought three types of stocks - Real Estate, Bonds and International. He bought 3 stocks in Real Estate, 2 stocks in
Compute Java ProgramRay Shimlock bought three types of stocks Real Estate, Bonds and International. He bought
stocks in Real Estate, stocks in Bonds and stocks in International. At the end of the year, he
made profit in Real Estate stocks, profit in Bonds stocks and profit actually a
loss in International stocks. Compute the net profit or loss for Ray at the end of the year.
Programming requirements
You must introduce variables for Real Estate stocks, variables for Bonds stocks and
variables for International stocks. Declare them all as double.
You must read all the values for these variables from the input. Use your own values. Suggested
value for a stock is between to
Calculate the profitloss as follows:
Add the Real Estate stocks and multiply it with Let us call this as result
declared as double
Add the Bonds stocks and multiply it with Let us call this as resultdeclared
as double
Add the International stocks and multiply it with Let us call this as result
declared as double
Add all the three results above. This is the net profit or loss. A positive value indicates
that it is a profit; a negative value means it is a loss.
You must print all the values all stocks and the net profitloss with appropriate captions.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
