Write a java program in which A class named Processor has  Two public attributes i.e. price and speed (float value like 2.8, 3.2 etc in MHz)  A parameterized constructor to initialize attributes with user-defined values Class MainMemory consists of  Two public attributes i.e. size (4,8 etc in Gb) and price  A parameterized constructor to initialize attributes with user-defined values Class MotherBoard has  a private data member named compName of type string  a no-argument or default constructor to initialize with default name intel  setter function setCompName() to set the name of the computer  getter function getCompName() to get the name of the computer Class Monitor has  a private data member named size (17, 19 inches) of type Int that represents size of screen  A parameterized constructor to initialize attribute size.  setter function setMonitorSize() to set the value to size.  getter function getMointorSize() to get the size of screen.  public remove() method, that will change the size of screen to zero (0) Design a class named Computer that includes  An array of type Processor. containing all the processors.  A data member named ram of type MainMemory  A data member named mboard of type MotherBoard  A data member named screen of type Mointor  A parameterized constructor that accept Three arguments of type string as computer Name, Array of all the Processors and type MainMemory to initialize members of these types. Moreover, within this constructor, instantiate object of Monitor class with default screen size of 15 inches.  A public setter function setMointor() that can change the size of monitor. if monitor size is set to Zero i.e 0. it's means that monitor does not exist  A display() function that print complete computer specification. like Computer: intel with monitor size 17 inches CPU(s): 1.8, 3.2, MHz RAM: 8 Gb  A Computer can't have more than 4 processors. in case of more than 4 processors, it should display error message. and also we all know that Computer can exist without monitor. Draw UML diagram for each class and show aggregation and composition relationship between these classes. You are also required to show cardinality in UML diagram, submit your design in PDF format.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Write a java program in which

A class named Processor has
 Two public attributes i.e. price and speed (float value like 2.8, 3.2 etc in MHz)
 A parameterized constructor to initialize attributes with user-defined values
Class MainMemory consists of
 Two public attributes i.e. size (4,8 etc in Gb) and price
 A parameterized constructor to initialize attributes with user-defined values
Class MotherBoard has
 a private data member named compName of type string
 a no-argument or default constructor to initialize with default name intel
 setter function setCompName() to set the name of the computer
 getter function getCompName() to get the name of the computer
Class Monitor has
 a private data member named size (17, 19 inches) of type Int that represents size of screen
 A parameterized constructor to initialize attribute size.
 setter function setMonitorSize() to set the value to size.
 getter function getMointorSize() to get the size of screen.
 public remove() method, that will change the size of screen to zero (0)
Design a class named Computer that includes
 An array of type Processor. containing all the processors.
 A data member named ram of type MainMemory
 A data member named mboard of type MotherBoard
 A data member named screen of type Mointor
 A parameterized constructor that accept Three arguments of type string as computer Name,
Array of all the Processors and type MainMemory to initialize members of these types.

Moreover, within this constructor, instantiate object of Monitor class with default screen size of

15 inches.

 A public setter function setMointor() that can change the size of monitor. if monitor size is set to

Zero i.e 0. it's means that monitor does not exist

 A display() function that print complete computer specification. like

Computer: intel with monitor size 17 inches

CPU(s): 1.8, 3.2, MHz

RAM: 8 Gb

 A Computer can't have more than 4 processors. in case of more than 4 processors, it should

display error message. and also we all know that Computer can exist without monitor.

Draw UML diagram for each class and show aggregation and composition relationship between these

classes. You are also required to show cardinality in UML diagram, submit your design in PDF format.

1. Problem Solving using UML: (8 Marks)
Draw UML class diagrams of the following example.
Problem:
A class named Processor has
Two public attributes i.e. price and speed (float value like 2.8, 3.2 etc in MHz)
A parameterized constructor to initialize attributes with user-defined values
Class MainMemory consists of
1/2
Two public attributes i.e. size (4,8 etc in Gb) and price
A parameterized constructor to initialize attributes with user-defined values
Class MotherBoard has
a private data member named compName of type string
a no-argument or default constructor to initialize with default name intel
setter function setCompName() to set the name of the computer
getter function getCompName() to get the name of the computer
Class Monitor has
a private data member named size (17, 19 inches) of type Int that represents size of screen
A parameterized constructor to initialize attribute size.
setter function setMonitorSize() to set the value to size.
getter function getMointorSize() to get the size of screen.
public remove() method, that will change the size of screen to zero (0)
Design a class named Computer that includes
An array of type Processor. containing all the processors.
A data member named ram of type MainMemory
A data member named mboard of type MotherBoard
A data member named screen of type Mointor
A parameterized constructor that accept Three arguments of type string as computer Name,
Array of all the Processors and type MainMemory to initialize members of these types.
Moreover, within this constructor, instantiate object of Monitor class with default screen size of
15 inches.
A public setter function setMointor() that can change the size of monitor. if monitor size is set to
Zero i.e 0. it's means that monitor does not exist
A display() function that print complete computer specification. like
Computer: intel with monitor size 17 inches
CPU(s): 1.8, 3.2, MHz
RAM: 8 Gb
A Computer can't have more than 4 processors. in case of more than 4 processors, it should
display error message. and also we all know that Computer can exist without monitor.
Transcribed Image Text:1. Problem Solving using UML: (8 Marks) Draw UML class diagrams of the following example. Problem: A class named Processor has Two public attributes i.e. price and speed (float value like 2.8, 3.2 etc in MHz) A parameterized constructor to initialize attributes with user-defined values Class MainMemory consists of 1/2 Two public attributes i.e. size (4,8 etc in Gb) and price A parameterized constructor to initialize attributes with user-defined values Class MotherBoard has a private data member named compName of type string a no-argument or default constructor to initialize with default name intel setter function setCompName() to set the name of the computer getter function getCompName() to get the name of the computer Class Monitor has a private data member named size (17, 19 inches) of type Int that represents size of screen A parameterized constructor to initialize attribute size. setter function setMonitorSize() to set the value to size. getter function getMointorSize() to get the size of screen. public remove() method, that will change the size of screen to zero (0) Design a class named Computer that includes An array of type Processor. containing all the processors. A data member named ram of type MainMemory A data member named mboard of type MotherBoard A data member named screen of type Mointor A parameterized constructor that accept Three arguments of type string as computer Name, Array of all the Processors and type MainMemory to initialize members of these types. Moreover, within this constructor, instantiate object of Monitor class with default screen size of 15 inches. A public setter function setMointor() that can change the size of monitor. if monitor size is set to Zero i.e 0. it's means that monitor does not exist A display() function that print complete computer specification. like Computer: intel with monitor size 17 inches CPU(s): 1.8, 3.2, MHz RAM: 8 Gb A Computer can't have more than 4 processors. in case of more than 4 processors, it should display error message. and also we all know that Computer can exist without monitor.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Development strategies
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education