12.07.2015 Views

HW Set 7 - thecubscientist.com

HW Set 7 - thecubscientist.com

HW Set 7 - thecubscientist.com

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

P7B. Consider the Television class on the next page. Write a program that will includethe following:a. Write four new classes, “Plasma”, “DLP”, “LCD”, and “LED” that extend theTelevision class shown below.b. For each of the above classes:i. Write a zero argument constructor for each of the above classes.ii.Write a new two argument constructor for each of these four classes thattake a String argument for the “model” of the Television and a doublefor the “cost” of the television.c. Write a driver program to create each one of these types of Televisions, includinga “Television” object and store them into an ArrayList of type Television. Use afor-each loop to polymorphically call the “toString()” method for eachTelevision in the ArrayList. Sample output is shown below:Page 2AP Computer Science – <strong>HW</strong> <strong>Set</strong> 7 Programshttp://<strong>thecubscientist</strong>.<strong>com</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!