Question: Write the code for a class named Stock. It has the following memebrs: + stock's symbol + stocks name + last month average closing price

Write the code for a class named Stock. It has the following memebrs:

+ stock's symbol + stocks name + last month average closing price + current month average closing price +constructor that creates a stock with symbol and name. +A method named momentum that returns the percentage changed from last month average closing price to current month average closing price.

Implement the class with two stocks ("goog", "Goolge", 200.45, 205.57) and ("yah", "Yahoo", 105, 107.3) and diaplay which one of them has heigher monentum.

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!