Question
Debug Java Code Instructions are: Code to copy: DebugBook.java public class DebugBook { protected pages; public DebugBook(int pgs) { pages = this.pgs; } public int
Debug Java Code
Instructions are:
Code to copy:
DebugBook.java
public class DebugBook
{
protected pages;
public DebugBook(int pgs)
{
pages = this.pgs;
}
public int getPages()
{
return pgs;
}
}
DebugPhoneBook.java
import java.util.*;
public class DebugPhoneBook extends DebugBook
{
private String area;
private String size;
private final int CUTOFF = 30;
DebugPhoneBook(int pages, String city)
{
super(pages);
area = city;
if(pages > CUTOFF)
size = "big";
else
size = "small";
public void display()
{
System.out.println("The phone book for " + area +
" has " + pages + " pages. That is a " +
size + " phone book.");
}
}
DebugTen3.java
// A PhoneBook is a Book with a city
import java.util.*;
public class DebugTen3
{
public static void main(String[] args)
{
String area, inStr;
Scanner input = new Scanner(System.in);
System.out.println("Enter city for phone book");
area = input.next();
System.out.println("Enter number of pages in " + area + "'s phone book");
inStr = input.next();
pages = Integer.parseInt(inStr);
DebugPhoneBook pb = new DebugPhoneBook(pages);
display();
}
}
Fix errors in starter code > 0.00 out of 10.00 O out of 3 checks passed. Review the results below for more details. Checks Test Case Incomplete Program produces correct output case 1 Input Austin 700 Output Results Enter city for phone book Enter number of pages in Austin's phone book The phone book for Austin has 700 pages. That is a big phone book. Test Case Incomplete Program produces correct output case 2 Input Seattle 25 Output Results Enter city for phone book Enter number of pages in Seattle's phone book The phone book for Seattle has 25 pages. That is a small phone book. Show Details Code Pattern Incomplete Call display method correctly Description Searched your code for a specific pattern: pb\displayStep 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