Question
You design a class named Computer. This class needs to have following member variables and member methods: Member Variables private String data field named brand
You design a class named Computer. This class needs to have following member variables and member methods:
Member Variables | private String data field named brand |
private boolean data field name status that specifies if the computer is on or not (default is false) | |
private double data field name weight (default is 5.5) | |
private int data field named ram (default is 0) | |
Constructors | Default constructor: public Computer() |
public Computer(int r, String b) | |
public Computer(int r, String s, double w) (r is ram, s is the brand and w is the weight) | |
Methods | The accessor and mutator methods for all four data fields |
A method named toString() that returns string description of the computer. |
You need to implement a TestComputer class. In this Test class, you need to create three Computer objects (C1, C2, and C3) using different constructors. Change the value of C1 (created by default) with users input values of brand HP, 4 pounds, and 16G ram. Get users input for ram and brand to create C2 using second constructor. After that, get users input of weight for C2, and change C2s weight. Get users input for ram, brand and weight to create C3 using third constructor.
Display objects by invoking their toString method.
Create a class diagram in UML notation.
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