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)
//processor method: upradeRAM(int)
//accessors: getBrand (), getPrice(), getRAM(), getUSB()
}
1. Write full class definition for the Laptop class.
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
  public Laptop (String brand, double price, int RAM, int USDport) {
    this.brand=brand;
    this.price=price;
    this.RAM=RAM;
    this.USDport=USDport;
  }
  
  void upgradeRAM(int n) {
    this.RAM += n;
  }
  public String getBrand() { return brand; }
  public double getPrice() { return price; }
  public int getRAM() { return RAM; }
  public int getUSDport() { return USDport; }
}
Comments