Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started