Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given the definition of Laptop class as follows: public class Laptop { private String brand; //HP, Acer, ASUS private double price; //price per unit

 

Given the definition of Laptop class as follows: public class Laptop { private String brand; //HP, Acer, ASUS private double price; //price per unit private int RAM; //memory space in GigaByte (GB), e.g: 2,4 private int USBport; //number of USB port, e.g: 2, 3, 4 //normal constructor: public Laptop (String, double, int, int) //printer method: toString0 //processor method: upgradeRAM (int) //accessors: getBrand (), get Price (), getRAMO, getUSB () Write the definition of the following methods: a) A normal constructor that initializes all data members with the given values through its parameter (brand= Acer, price = RM3,999, RAM = 4Gb, USB Port = 2). b) (3 marks) Write the accessor method get Brand () to get the laptop brand and accessor method getUSB () to get number of USB port. (3 marks)

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

Fundamental Statistics for the Behavioral Sciences

Authors: David C. Howell

8th Edition

1285076915, 978-1285076911

More Books

Students also viewed these Databases questions

Question

8 for 0 Answered: 1 week ago

Answered: 1 week ago

Question

=+c) What do you conclude about the average value of the

Answered: 1 week ago