Answered step by step
Verified Expert Solution
Link Copied!

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

JAVA1. 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 1,speed to 2.1e9, and memory to 4000000000L.
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.]
2. 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Systems A 360-degree Approach

Authors: Jawwad ShamsiMuhammad Khojaye

1st Edition

0429531575, 9780429531576

More Books

Students also viewed these Databases questions

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago