Laptop factory

Report a typo

In this task, you will be the owner of the LaptopFactory. You've got two customers who want to buy Windows and macOS laptops. You should provide these laptops by asking your factory to create them and writing some more code in your TestDrive class.

You need to fix lines marked by comments /* write your code here */

Sample Input 1:

Sample Output 1:

-Hello, I need a Windows laptop
-Okay! Please wait a sec, - Calling to the DellXpsFactory. -Bring me a Dell laptop
This is a Dell XPS 9370
Display: 13" FHD screen
GraphicCard: Intel UHD 620 GPU
Processor: Core i7
SSD: 256Gb SSD
There it is!

-Hello, I need a macOS laptop
-Okay! Please wait a sec, - Calling to the MacBookFactory. -Bring me a MacBook laptop
This is a MacBook Pro 13"
Display: 13" 4K display
GraphicCard: Intel Iris Plus Graphics 640
Processor: Dual-Core i5
SSD: 256Gb SSD
There it is!
Write a program in Java 17
class TestDrive {

public static void main(String[] args) {
Laptop laptop;

LaptopFactory dellFactory = /* write your code here */
LaptopFactory macbookFactory = /* write your code here */

System.out.println("-Hello, I need a Windows laptop");
System.out.println("-Okay! Please wait a sec, - Calling to the DellXpsFactory. " +
"-Bring me a Dell laptop");

laptop = /* write your code here */
System.out.println(laptop.getDescription());
System.out.println("There it is!\n");

System.out.println("-Hello, I need a macOS laptop");
System.out.println("-Okay! Please wait a sec, - Calling to the MacBookFactory. " +
"-Bring me a MacBook laptop");

laptop = /* write your code here */
System.out.println(laptop.getDescription());
System.out.println("There it is!");
}
}

interface LaptopFactory {
Laptop createComputer();
}

class MacBookFactory implements LaptopFactory {

@Override
public Laptop createComputer() {
LaptopDetailsFactory detailsFactory = new MacBookDetailsFactory();

___

Create a free account to access the full topic