Answered step by step
Verified Expert Solution
Question
1 Approved Answer
What is the finished code in Java? Create a class called PrinterApp as well as the following three classes as specified in the class diagrams
What is the finished code in Java?
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 Printer - serialNumber: int + constructor Printer (number: int ) + print () +toString : String LaserPrinter InkietP rinter remaining Toner: int + constructor> LasserPrinter sNumber int) + getRemainingToner )int + print () - remainingCartridge: int + constructor InkjetPrinter(sNumber int) +getRemainingCartridge ():int +print () 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 eg.: LaserPrinter is printing. Remaining toner: 90% eg.: Inkjet Printer is printing. Remaining cart rdge: 80% If the field is 0 print a message that the toner / cartridge is empty. Do NOT subtract anything from 0. b)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