You are given the following code that contains an interface called Printer, a class called Office and a driver. This code has errors and does not work. Identify the errors and explain why they are not acceptable

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 20RQ
icon
Related questions
Question

Java programming question

You are given the following code that contains an interface called Printer, a class called Office and a
driver. This code has errors and does not work. Identify the errors and explain why they are not
acceptable
public interface Printer{
public void printcolor();
public void printLaserQuality();
public class Office implements Printer{
Printer p = new Printer();
public void printlaserQuality(){
System.out.println("Set the toner to high");
}
class Main {
public static void main(String[] args) {
Office o - new Office();
//make a report
o. printlaserQuality();
//print a laserQuality report on printer p
// do something
}
}
Transcribed Image Text:You are given the following code that contains an interface called Printer, a class called Office and a driver. This code has errors and does not work. Identify the errors and explain why they are not acceptable public interface Printer{ public void printcolor(); public void printLaserQuality(); public class Office implements Printer{ Printer p = new Printer(); public void printlaserQuality(){ System.out.println("Set the toner to high"); } class Main { public static void main(String[] args) { Office o - new Office(); //make a report o. printlaserQuality(); //print a laserQuality report on printer p // do something } }
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Introduction to computer system
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,