Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 1 a) Explain Three (3) differences of Structured programming paradigm and Object-oriented programming paradigm. [6 marks] b) Write the object oriented terminology for each
Question 1 a) Explain Three (3) differences of Structured programming paradigm and Object-oriented programming paradigm. [6 marks] b) Write the object oriented terminology for each of the following object oriented features: i) A blueprint for an object which defines all the data items contained in the object and the operations that are permitted for the data. A representation of something within the domain that the program models which contains values of data and which implements operations on that data. 111 An operation which will manipulate the data contained in an object. iv) A variable which holds data that is relevant to all the objects created from the same template. [4 marks] Question 2 a) What is a Unified Modelling Language (UML)? UML Class diagram is a diagram that represents class. Explain about the setter(mutator), getter(accessor) and constructor methods in the class diagram Question 2 b) In number theory, a value can be categorised as a natural number (a whole number>0, often denoted N), an integer (zero or a positive or negative whole number, including the natural numbers, often denoted Z), or a real number (which includes the natural numbers and integers, along with all other positive and negative numbers that are not integers, often denoted R). Draw a class diagram for a number that contains: 1) the class name is Number, [1 mark] ii) int attributes(variables) num for storing a real number, [1 mark] 111) setter(mutator) and getter(accessor) methods for manipulating this attribute(variable): [2 marks] iv) a constructor for class Number that initializes Number to 1; [1 mark] v) a constructor for class Number that accepts an integer input; int number. [1 mark] vi) a method determine Num that determines which kind of number is currently stored (returning 0 if the number is real and an integer and a natural number, 1 if the number is real and integer but not a natural number, and 2 if the number is real but neither an integer nor a natural number). [1 mark] Question 3 The class diagram in Figure 2 shows the relationship between class Doctor and class Patient. Doctor docid:int name:String department:String Patient patientID:String patientName:String Patient(patientID:String,patientName:String) +payBillo +getPatiento +prescribeMeds +prescribe Test Figure 2 a) Explain how encapsulation is implemented in these classes. How will you implement the concept of data hiding to these classes? [4 marks] b) Put the appropriate modifier(visibility) to each attributes and methods in each class. [5 marks]
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started