Question: Create a class called PrinterApp as well as the following three classes as specified in the class diagrams. Notice that the class name Printer and
Create a class called PrinterApp as well as the following three classes as specified in the class diagrams. Notice that the class name Printer and its method print are spelled in italic. This indicates that Printer is an abstract class and print is an abstract method. Ad Printer: Printer is an abstract class and print is an abstract method. The method toString returns a string of the following form: className #idNumber (e.g. InkjetPrinter #1234567 or LaserPrinter #2345678 ) Ad LaserPrinter / InkjetPrinter: In the constructor do the following: Set the value of remainingToner / remainingCartridge to 100 (100% full when new) and initialize the base class In method print do the following: a) If the remainingToner / remainingCartridge is greater 0 reduces the value by 10 It also prints a message that informs the user that the printer is printing and how much toner / cartridge is left. e.g.: LaserPrinter is printing. Remaining toner: 90% e.g.: InkjetPrinter is printing. Remaining cartrdge: 80% b) If the field is 0 print a message that the toner / cartridge is empty. Do NOT subtract anything from 0. CSIS-1410 PrinterApp: Create an instance of InkjetPrinter Print the instance Print how much cartridge is remaining Create an instance of LaserPrinter Print the instance Print how much toner is remaining Print a label List of Printer: Create an ArrayList of printers and add the two printer instances you just created User a foreach loop to loop through all the printers Print the instance, make the printer print 11 times print an empty line Compile and run InkjetPrinter #1234567 Remaining Cartridge: 100% LaserPrinter #2345678 Remaining Toner: 100% List of Printers: InkjetPrinter #1234567 InkjetPrinter is printing. Remaining cartridge: 90% ... InkjetPrinter is printing. Remaining cartridge: 0% Cartridge is empty LaserPrinter #2345678 LaserPrinter is printing. Remaining toner: 90% ... LaserPrinter is printing. Remaining toner: 0% Toner is empty
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
