Question: 1. Create a new Java project called inlab4. 2. Create a package called model and a package called test. 3. In the model package, add
1. Create a new Java project called inlab4. 2. Create a package called model and a package called test. 3. In the model package, add the following class: package model; public class Laptop f private String maker; private double price; private static int numberOfLaptops public Laptop(String maker, double price) ( this.maker maker this.price - price; numberOjLaptops+; public String getMakerO i public double getPrice0 public void setMaker(String maker) ( public void setPrice(double price) f return maker; return price; this.maker maker; if (pricec0) this.price price; this.price- 0 else public String toString0f return String,format("Marker: %s, Price: QR%.2f", maker,price); 4. In the model, add a class called Person that contains three data fields: id (int), name (String) and laptop (Laptop). Your class should have a constructor that initializes the three instance variables. Provide the setter and the getter method for each instance variable. a) Add a method called hasLaptop0 that returns true if the laptop instance variable is not null and returns false otherwise
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
