Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java True or false: The code shown on line 9 of the DividendStock class, super(symbol) illustrated how a subclass can call its parents constructor. call

Java
True or false:
The code shown on line 9 of the DividendStock class, super(symbol) illustrated how a subclass can call its parents constructor. image text in transcribed
image text in transcribed
call Stock's getProtit method a methods share the same name, call stock's version. Again, you do this using the n have DividendStocks ger of its computation. However, since the two ant to you must explicitly tell the compiler that you w Here is the corrected code, which does compile and elma super keyword. redundancy / returns the total protit or loss earned on this stock. including profits made from dividends blic double getProfit (double currentPrice) return super.getProfit(currentpricej dividends And here is the code for the completed Dividendstock c lass: 1 1 A Dividendstock object represents a stock puren 2 // dividends. 3 public class DividendStock extends stock ( purchase that also pays private double dividends; I1 amount of dividends paid // construets a new dividend stock with the given symbol /I and no shares purchased public DividendStock(String symbol) super (symbol): II call Stock constructor dividends -0.0; 10 12 ock, 13 // returns the total profit or loss earned on this st

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions