Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

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

  • 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.

2. Implementation: (12 marks)

Implement the above classes in Main() method. Create three computers with data given below, this is the output that your program should display.

Computer: intel with monitor size 17 inches

CPU(s): 1.8, 2.2, MHz

RAM: 4 Gb

Computer: Dell without monitor

CPU(s): 1.8, 2.2, 3.3, MHz

RAM: 8 Gb

Computer: hp with monitor size 15 inches

CPU(s): 1.8, MHz

RAM: 2 Gb

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Database Systems

Authors: Carlo Zaniolo, Stefano Ceri, Christos Faloutsos, Richard T. Snodgrass, V.S. Subrahmanian, Roberto Zicari

1st Edition

155860443X, 978-1558604438

More Books

Students also viewed these Databases questions

Question

2.9 Describe the diathesis-stress model of abnormal behavior.

Answered: 1 week ago

Question

=+ Who do you think is right? Why?

Answered: 1 week ago