Question
Part 1 Classes and objects Create a new Java project called firstName_lastName_Part1 in Netbeans. Select the option to create a main method. Create a new
Part 1 Classes and objects Create a new Java project called firstName_lastName_Part1 in Netbeans. Select the option to create a main method. Create a new class called Computer. In the Computer class write the code for: Instance variables to store the computers make and model Two other instance variables that are appropriate for a computer A default constructor and a second constructor that initialises all four of the instance variables Accessor (getters) and mutator methods (setters) for all four of the instance variables A method called printDetails that prints the computers details e.g. The computers details are: followed by all four of the instance variables formatted for readability In the main method write the code to: Create 2 computers, one using the default constructor, the other using the constructor that initialises all the instance variables for the computer Demonstrate the use of one accessor method and one mutator method for one of the computers you created Print the computers details using the printDetails method for one of the computers you created Part 2 Inheritance, collections and polymorphism Create a new Java project called firstName_lastName_Part2 in Netbeans. Select the option to create a main method. Create a new class called Computer. Create a second new class called Laptop. Modify the new Laptop class so that it extends Computer (Computer is the superclass; Laptop is the subclass). Rewrite the program you created in Part 1 so that: The instance variables and accessor and mutator methods for the make and model are in the Computer class The two other instance variables and accessor and mutator methods are in the Laptop class 3 The 2 constructors in the Laptop class call the appropriate constructors in the Computer class using the super keyword. The constructor in the Laptop class that takes parameters must initialise the make and model in the Computer class The Computer class has a method called printDetails that prints the make and model of the computer. Override the printDetails method in the Laptop class and print all of the laptop details as you did in part 1. The printDetails method in the Laptop class must use the super keyword to call the printDetails method in the Computer class In the main method write the code to: Declare an ArrayList with a type parameter of Laptop Add at least 2 laptops to the ArrayList Use an Iterator (java.util.Iterator) to loop through the laptops in the ArrayList and print out the make and model. Please note that use of any other kind of loop will not receive any marks. Check if the ArrayList contains a particular laptop Get a laptop from the ArrayList Remove a laptop from the ArrayList Print the size of the ArrayList Clear the ArrayList In the class that contains the main method, create a second method that takes a Computer as a parameter. Write the code to print out the computers make and model using the Computer accessor methods. Then create an object of type Laptop and an object of type Computer in the main method and use the method you have just created to demonstrate polymorphism. Part 3 Abstract classes Create a new Java project called firstName_lastName_Part3 in Netbeans. Select the option to create a main method. Create a new class called Laptop. Create a second new class called Computer. Rewrite your code from Part2 so that: The Computer class is abstract. The Computer contains at least one abstract method All methods, constructors etc that were in the Laptop and Computer classes in part 2 must be included in part 3. You need to rewrite the Laptop and Computer classes from part 2 so that Computer is abstract and there are multiple ways to create a Laptop. Check your code works by creating a new Laptop in your main method. 4 Part 4 Interfaces Create a new Java project called firstName_lastName_Part4 in Netbeans. Select the option to create a main method. Create a new class called Laptop. Create a new interface called Computer. Rewrite your code from Part2 so that: Computer is an interface Laptop implements Computer. All methods, constructors etc that were in the Laptop and Computer classes in part 2 must be included in part 4. You need to rewrite the Laptop and Computer classes from part 2 so that Computer is an interface and there are multiple ways to create a Laptop. Check your code works by creating a new Laptop in your main method.
CAN YOU please provide me the answer me part 3 and part 4
thank you that would help me a lot.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started