Answered step by step
Verified Expert Solution
Question
1 Approved Answer
JAVA 1 . Create a Computer class with the following attributes: int type core , double type speed , long type memory . Create the
JAVA Create a Computer class with the following attributes: int type core double type speed long type memory Create the following constructors and methods:
a Default constructor which will initialize the attributes to the following values:
core to speed to e and memory to L
b Parameterized constructor which will initialize the attributes. clue there will be three parameters and those will correspond to the attributes
c Get methods for all the attributes remember that each get method will have return type similar to the corresponding attribute and it wont have any parameter
d Set methods for all the attributes remember that each set method will take a parameter that matches the corresponding attribute and it will modify the value of the corresponding attribute.
Create Driver class and add main method
i Within the main method instantiate an object of type Computer with default constructor. Computer comp new Computer;
ii Now, print the number of cores, speed and memory size of your computer.
iii. Now instantiate another object of Computer type with parameterized constructor. Provide the values of your choice for the parameters.
Computer comp new Computer core, speed, memory ;
iv Now, print the number of cores, speed and memory size of your computer
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