Question: Please answer question C only. Given the definition of Laptop class as follows: begin{tabular}{l} public class Laptop { private string brand; //Hp, Acer,

 Please answer question C only. Given the definition of Laptop class

Please answer question C only.

Given the definition of Laptop class as follows: \begin{tabular}{l} 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; /umber of USB port, e.g: 2,3,4 \\ /ormal constructor: public Laptop (String, double, int, int) \\ // printer method: tostringo \\ //processor method: upgradeRAM(int) \\ //accessors: getBrand (), getPrice (), getRAMO, getUSB() \\ \hline \end{tabular} 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 ). (3 marks) b) Write the accessor method getBrand () to get the laptop brand and accessor method getUSB ( ) to get number of USB port. (3 marks) c) A processor method named upgradeRAM with return value is (int) that receive the size of RAM to be upgraded as its parameter. This method will determine and return the price of RAM based on the following table

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!