Question: 1 . ( 1 0 pts ) After reading the code as below, please answer the following questions. Draw the UML diagram for this design
pts After reading the code as below, please answer the following questions. Draw the UML diagram for this design pattern given the java code. Explain the importance of this design pattern.
interface CPU
void process;
interface CPUFactory
CPU produceCPU;
class AMDFactory implements CPUFactory
public CPU produceCPU
return new AMDCPU;
class IntelFactory implements CPUFactory
public CPU produceCPU
return new IntelCPU;
class AMDCPU implements CPU
public void process
System.out.printlnAMD is processing...";
class IntelCPU implements CPU
public void process
System.out.printlnIntel is processing...";
class Computer
CPU cpu;
public ComputerCPUFactory factory
cpu factory.produceCPU;
cpu.process;
public class Client
public static void mainString args
new ComputercreateSpecificFactory;
public stic CPUFactory createSpecificFactory
int sys ; based on specific requirement
if sys
return new AMDFactory;
else
return new IntelFactory;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
