Question: src/cs1302/Product.java: package cs1302; public abstract class Product { protected int id; public Product(int id) { this.id = id; } // Product public int getId() {


src/cs1302/Product.java: package cs1302; public abstract class Product { protected int id; public Product(int id) { this.id = id; } // Product public int getId() { return id; } // getId } // Product src/cs1302/amazeon/Book.java: package cs1302.amazeon; import cs1302.Product; public class Book extends Product { private String author; public Book(int id, String author) { super(id); if (author != null) { this.author = author; } else { throw new NullPointerException("author cannot be null"); } // if } // Book public String getAuthor() { return author; } // getAuthor } // Book src/cs1302/googol/TechBook.java: package cs 1302.googol; import cs1302.amazeon. Book; public class TechBook extends Book { private boolean code; public TechBook (int id, String author, boolean code) { super(id, author); this.code = code; } // TechBook } // TechBook As always, you are encouraged to type up the code and test out the various options. If any keywords in the program were not directly mentioned in the tutorial, feel free to look them up online or see how they work through experimentation. public String getAuthor(int pad) { String name = getAuthor(); return String.format("8" + pad + "s", name); } // getAuthor @Override public String gettAuthor() { return super.getAuthor() + } // getAuthor [Tech Author]"; 11 public String gettAuthor() { return getAuthor() + [Tech Author]"; } // getAuthor public String getAuthor() { return "[Tech Author]"; } // getAuthor public String getAuthor() { String name = super.getAuthor(); return name " (TECH)"; } // getAuthor @Override public String getAuthor() { String name = super.getAuthor(); return "[Tech] + name; } // getAuthor
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
