Please check the question with the given image and revised it if the code is complete. If not, please add what is missing. Please add comments on what you did. in Java eclipse. please see the code below: class Computer {     private String model;     private String brandName;     private String manufacturingDate;     private int numberOfCores;     public Computer() {     }     public Computer(String model, String brandName, String manufacturingDate, int numberOfCores) {         this.model = model;         this.brandName = brandName;         this.manufacturingDate = manufacturingDate;         this.numberOfCores = numberOfCores;     }     public String getModel() {         return model;     }     public void setModel(String model) {         this.model = model;     }     public String getBrandName() {         return brandName;     }     public void setBrandName(String brandName) {         this.brandName = brandName;     }     public String getManufacturingDate() {         return manufacturingDate;     }     public void setManufacturingDate(String manufacturingDate) {         this.manufacturingDate = manufacturingDate;     }     public int getNumberOfCores() {         return numberOfCores;     }     public void setNumberOfCores(int numberOfCores) {         this.numberOfCores = numberOfCores;     }     @Override     public String toString() {         return "Computer{" +                 "model='" + model + '\'' +                 ", brandName='" + brandName + '\'' +                 ", manufacturingDate='" + manufacturingDate + '\'' +                 ", numberOfCores=" + numberOfCores +                 '}';     } } class Desktop extends Computer{     private double width;     private double height;     // Default constructor     public Desktop() {     }     // All argument constructor     public Desktop(String model, String brandName, String manufacturingDate, int numberOfCores, double width, double height) {         super(model, brandName, manufacturingDate, numberOfCores);         this.width = width;         this.height = height;     }     // Getter for width     public double getWidth() {         return width;     }     // Setter for width     public void setWidth(double width) {         this.width = width;     }     // Getter for height     public double getHeight() {         return height;     }     // Setter for height     public void setHeight(double height) {         this.height = height;     }     // Overridden toString() method     @Override     public String toString() {         return "Desktop{" +                 "width=" + width +                 ", height=" + height +                 '}';     } } class Laptop extends Computer{     private double weight;     // Default constructor     public Laptop() {     }     // All argument constructor     public Laptop(String model, String brandName, String manufacturingDate, int numberOfCores, double weight) {         super(model, brandName, manufacturingDate, numberOfCores);         this.weight = weight;     }     // Getter for weight     public double getWeight() {         return weight;     }     // Setter for weight     public void setWeight(double weight) {         this.weight = weight;     }     // Overridden toString() method     @Override     public String toString() {         return "Laptop{" +                 "weight=" + weight +                 '}';     } } public class TestComputer {     public static void main(String[] args) {         Computer c1= new Computer ("Inspiron 1545", "DELL", "April 1, 2020", 2);//Object 1          System.out.println("Model Number : " + c1.getModelNumber());         System.out.println("BrandName : " + c1.getBrandName());         System.out.println("manufacturingDate : " + c1.getManufacturingDate());         System.out.println("NumberOfCores: " + c1.getNumberOfCores());         System.out.println(" ");         //Object 2         Computer c2= new Computer ("A2338", "Macbook", "March 31, 2020 ", 4);//Object 1          System.out.println("Model Number : " + c2.getModelNumber());         System.out.println("BrandName : " + c2.getBrandName());         System.out.println("manufacturingDate : " + c2.getManufacturingDate());         System.out.println("NumberOfCores: " + c2.getNumberOfCores());         System.out.println(" ");         //Object 3 (my own object)         Computer c3= new Computer ("1165G7", "HP", "October 15, 2014", 7);//Object 1          System.out.println("Model Number : " + c3.getModelNumber());         System.out.println("BrandName : " + c3.getBrandName());         System.out.println("manufacturingDate : " + c3.getManufacturingDate());         System.out.println("NumberOfCores: " + c3.getNumberOfCores());         System.out.println(" ");                  //Object for Desktop         Desktop d1= new Desktop ();//Object 1          System.out.println("The width is : " + d1.getWidth());         System.out.println("The height is : " + d1.getHeight());         System.out.println(" ");         //Object for Laptop         Laptop l1= new Laptop ();//Object 1          System.out.println("The weight is : " + l1.getWeight());                       } }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Please check the question with the given image and revised it if the code is complete. If not, please add what is missing. Please add comments on what you did. in Java eclipse.

please see the code below:

class Computer {
    private String model;
    private String brandName;
    private String manufacturingDate;
    private int numberOfCores;

    public Computer() {
    }

    public Computer(String model, String brandName, String manufacturingDate, int numberOfCores) {
        this.model = model;
        this.brandName = brandName;
        this.manufacturingDate = manufacturingDate;
        this.numberOfCores = numberOfCores;
    }

    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }

    public String getBrandName() {
        return brandName;
    }

    public void setBrandName(String brandName) {
        this.brandName = brandName;
    }

    public String getManufacturingDate() {
        return manufacturingDate;
    }

    public void setManufacturingDate(String manufacturingDate) {
        this.manufacturingDate = manufacturingDate;
    }

    public int getNumberOfCores() {
        return numberOfCores;
    }

    public void setNumberOfCores(int numberOfCores) {
        this.numberOfCores = numberOfCores;
    }

    @Override
    public String toString() {
        return "Computer{" +
                "model='" + model + '\'' +
                ", brandName='" + brandName + '\'' +
                ", manufacturingDate='" + manufacturingDate + '\'' +
                ", numberOfCores=" + numberOfCores +
                '}';
    }
}

class Desktop extends Computer{
    private double width;
    private double height;

    // Default constructor
    public Desktop() {
    }

    // All argument constructor
    public Desktop(String model, String brandName, String manufacturingDate, int numberOfCores, double width, double height) {
        super(model, brandName, manufacturingDate, numberOfCores);
        this.width = width;
        this.height = height;
    }

    // Getter for width
    public double getWidth() {
        return width;
    }

    // Setter for width
    public void setWidth(double width) {
        this.width = width;
    }

    // Getter for height
    public double getHeight() {
        return height;
    }

    // Setter for height
    public void setHeight(double height) {
        this.height = height;
    }

    // Overridden toString() method
    @Override
    public String toString() {
        return "Desktop{" +
                "width=" + width +
                ", height=" + height +
                '}';
    }
}

class Laptop extends Computer{
    private double weight;

    // Default constructor
    public Laptop() {
    }

    // All argument constructor
    public Laptop(String model, String brandName, String manufacturingDate, int numberOfCores, double weight) {
        super(model, brandName, manufacturingDate, numberOfCores);
        this.weight = weight;
    }

    // Getter for weight
    public double getWeight() {
        return weight;
    }

    // Setter for weight
    public void setWeight(double weight) {
        this.weight = weight;
    }

    // Overridden toString() method
    @Override
    public String toString() {
        return "Laptop{" +
                "weight=" + weight +
                '}';
    }
}

public class TestComputer {

    public static void main(String[] args) {
        Computer c1= new Computer ("Inspiron 1545", "DELL", "April 1, 2020", 2);//Object 1 
        System.out.println("Model Number : " + c1.getModelNumber());
        System.out.println("BrandName : " + c1.getBrandName());
        System.out.println("manufacturingDate : " + c1.getManufacturingDate());
        System.out.println("NumberOfCores: " + c1.getNumberOfCores());
        System.out.println(" ");
        //Object 2
        Computer c2= new Computer ("A2338", "Macbook", "March 31, 2020 ", 4);//Object 1 
        System.out.println("Model Number : " + c2.getModelNumber());
        System.out.println("BrandName : " + c2.getBrandName());
        System.out.println("manufacturingDate : " + c2.getManufacturingDate());
        System.out.println("NumberOfCores: " + c2.getNumberOfCores());
        System.out.println(" ");
        //Object 3 (my own object)
        Computer c3= new Computer ("1165G7", "HP", "October 15, 2014", 7);//Object 1 
        System.out.println("Model Number : " + c3.getModelNumber());
        System.out.println("BrandName : " + c3.getBrandName());
        System.out.println("manufacturingDate : " + c3.getManufacturingDate());
        System.out.println("NumberOfCores: " + c3.getNumberOfCores());
        System.out.println(" ");
        
        //Object for Desktop
        Desktop d1= new Desktop ();//Object 1 
        System.out.println("The width is : " + d1.getWidth());
        System.out.println("The height is : " + d1.getHeight());
        System.out.println(" ");
        //Object for Laptop
        Laptop l1= new Laptop ();//Object 1 
        System.out.println("The weight is : " + l1.getWeight());
        
        
    }

}

**Educational Website Content: Java Programming Guide**

### Part 1: Create a Parent Class

Create a complete Java class `Computer` that can be used to create the object as described below:

#### A Computer Has:
- **Model**
- **Brand Name**
- **Manufacturing Date**
- **Number of Cores**

#### Requirements:
a) Add all instance variables (data encapsulation is expected).  
b) The class must have getters and setters for all instance variables.  
c) The class must have a no-arg constructor and another constructor that receives input parameters for each instance variable.  
d) Implement `toString()` method for this class to print the contents of the data fields.

### Part 2: Test a Parent Class

Write a Java program `TestComputer`, which creates three `Computer` objects with the information below:

a) 
- **Model Number**: Inspiron 1545
- **Brand Name**: DELL
- **Manufacturing Date**: April 1, 2020
- **Number of Cores**: 2

b) 
- **Model Number**: A2338
- **Brand Name**: MacBook
- **Manufacturing Date**: March 31, 2020
- **Number of Cores**: 4

c) Create your own object. You can mimic your actual personal computer or use a no-args constructor.

### Part 3: Create Two Child Classes

Create two Java classes, `Desktop` and `Laptop` that are both subclasses of `Computer`.

a) **A Desktop** has additional instance variables: `width` and `height` (data encapsulation is expected).

b) **A Laptop** has an additional instance variable, `weight` (data encapsulation is expected).

1) Write constructors for both classes that require input for all their instance variables (including `Model Number`, `Brand Name`, `Manufacturing Date` and `Number of Cores`) as well as their own instance variables. Use a no-args constructor.

2) Create getters and setters for all instance variables for both child classes.

3) Create `toString()` methods (overridden) in `Desktop` and `Laptop` classes.

### Part 4: Test Two Child Classes

Test your newly created classes using the same `TestComputer` program you previously created; create two new `Laptop` and `Desktop` with the data of your
Transcribed Image Text:**Educational Website Content: Java Programming Guide** ### Part 1: Create a Parent Class Create a complete Java class `Computer` that can be used to create the object as described below: #### A Computer Has: - **Model** - **Brand Name** - **Manufacturing Date** - **Number of Cores** #### Requirements: a) Add all instance variables (data encapsulation is expected). b) The class must have getters and setters for all instance variables. c) The class must have a no-arg constructor and another constructor that receives input parameters for each instance variable. d) Implement `toString()` method for this class to print the contents of the data fields. ### Part 2: Test a Parent Class Write a Java program `TestComputer`, which creates three `Computer` objects with the information below: a) - **Model Number**: Inspiron 1545 - **Brand Name**: DELL - **Manufacturing Date**: April 1, 2020 - **Number of Cores**: 2 b) - **Model Number**: A2338 - **Brand Name**: MacBook - **Manufacturing Date**: March 31, 2020 - **Number of Cores**: 4 c) Create your own object. You can mimic your actual personal computer or use a no-args constructor. ### Part 3: Create Two Child Classes Create two Java classes, `Desktop` and `Laptop` that are both subclasses of `Computer`. a) **A Desktop** has additional instance variables: `width` and `height` (data encapsulation is expected). b) **A Laptop** has an additional instance variable, `weight` (data encapsulation is expected). 1) Write constructors for both classes that require input for all their instance variables (including `Model Number`, `Brand Name`, `Manufacturing Date` and `Number of Cores`) as well as their own instance variables. Use a no-args constructor. 2) Create getters and setters for all instance variables for both child classes. 3) Create `toString()` methods (overridden) in `Desktop` and `Laptop` classes. ### Part 4: Test Two Child Classes Test your newly created classes using the same `TestComputer` program you previously created; create two new `Laptop` and `Desktop` with the data of your
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 5 images

Blurred answer
Knowledge Booster
Running Time of Application
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education