Question: he Factory Method pattern defines an interface or abstract class for creating objects in a superclass but allows subclasses to alter the type of objects

he Factory Method pattern defines an interface or abstract class for creating objects in a superclass but allows subclasses to alter the type of objects to be created. Use NetBeans to create a Java program that implements this design pattern. Name your project TestFactory. Create an abstract superclass named Laptop. Any subclass of an abstract class must either implement all of the abstract methods in the superclass or be declared abstract itself. Copy the code below. abstract class Laptop { public abstract int getRAM(); public abstract int getSSD(); public abstract String getCPU(); public String toString() { return "RAM=" this.getRAM() "GB, SSD=" this.getSSD() ", CPU=" this.getCPU(); } } Create a subclass named Minimum that extends your superclass. In this class, declare three (3) private variables with the following names and data types: ram (int) ssd (int) cpu (String) Copy the code below for the constructor of your Minimum class. This constructor has three (3) parameters: ram, ssd, and cpu. Parameters are separated by commas as seen below. public Minimum(int ram, int ssd, String cpu){ this.ram=ram; this.ssd=ssd; this.cpu=cpu; } Create three (3) public getter methods named after the abstract methods in your superclass. These methods should return the value of the instance

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 Programming Questions!