COMP2129_assignment1_2023

docx

School

George Brown College Canada *

*We aren’t endorsed by this school

Course

2129

Subject

Computer Science

Date

Dec 6, 2023

Type

docx

Pages

11

Uploaded by HighnessMetal9708

Report
Advanced Object Oriented Programming Mini Assignment 1 (10%) Average Time to complete: 2 and a half hours Time given: 1 Week and 3 days. Due: Friday 29th September at 11:30 pm Submission: On Blackboard. Format: Upload this completed document This project must be done in a group. Group size: 2 to 4 people. It consists of 4 parts.
Group member First name Last name Student id number 1 Ishika Koshiya 101413772 2 Nandani Kevadiya 101413773 3 Pratham Bavlawala 101410156 4 Krishna Thakkar 101398578 One member of the group is responsible for uploading the completed document.
s Question1: What is aggregation with respect to OOP? – (1 mark) In your explanation you must: - Differentiate between the two forms aggregation and composition. (1 mark each) - Explain how they are shown in UML. – (0.5 marks each) Total for question: [ 4 marks ] (Delete the lines after the question and insert your response) Answer: - Aggregation represents a form of association in which a class can exist and can refer to other classes, but a contained class can exist independently for example the engine can be used although the car is destroyed. - Difference between the aggregation and composition is that in aggregation contained class can exist independently but in composition, if a class is destroyed, the contained class cannot exist independently. - In the UML diagram, aggregation means the end of the arrow has an open diamond and the composition has a shaded diamond.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Question2: Clearly explain the difference between an object and a class (you may use examples or diagrams to assist). Total for question [ 3 marks ] (Delete the lines after the question and insert your response) Answer: Difference between the class and object: A class is a template for creating objects and defines the structures of all entities while the object is one particular instance of a class. For example, to make a car you will need a blueprint or plan which represents class, and the entities of the car made on the basis of the blueprint are objects. A class defines data, methods, and properties including a valid range of values and default value. On the other hand, objects will perform according to the class’s methods and can store their unique data. In short object’s behaviour is dependent on class. A class can be referred to as a logical existence and an object can be referred to as a physical existence. Again by car example, the car is class whereas companies like Honda, Mahindra, and Toyota are objects.
Question 3: What is an access modifier and why is it important? -( 1 mark for its importance and usage) In your explanation you must also indicate: - The differences between public and private access modifiers. -(0.5 marks each) - How are they shown in a UML diagram. –(0.5 marks each) Total for question: [ 3 marks ] (Delete the lines after the question and insert your response) Answer: - Access modifiers are symbols used in programming. It can control the visibility of the class members from outside the class. An access modifier is important because it helps to maintain our code and provides encapsulation. They control the accessibility of class members ensuring the security of the data in the class. - Difference between the public and private access modifier: In the public access modifier, the data is accessible anywhere inside and outside of the class but in private, it cannot be accessed from outside of the class. Every part of the program can use the data in public whereas the private access modifier provides data encapsulation so that an individual can hide their internal details.
- In the UML diagram, the access modifiers are usually shown with the symbols. The public access modifier is represented by the symbol “ +” and the private access modifier is represented by the symbol “ – “.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Question 4: [10 marks] A company rents out planes to private pilots. Bookings are made when a client reserves a plane for a specified date. Planes are picked up and dropped off at specified airports. This is usually done on the telephone. Planes can be booked for one (1) day only and are booked for the whole day. The company would like to computerize their system. The company clerk will be entering information into a computer while speaking to a client on the telephone. The clerk will need to retrieve information (e.g. plane details, airport details, or client details if the clerk is dealing with an existing client) and create new bookings using the system. The clerk must be able to add, delete and update information on planes and airports. The clerk must also be able to add new clients as well as record new bookings and checking the availability of planes for specific dates. You must come up with appropriate state (3 to 4 state values are acceptable) information for all classes involved. All collections must be shown as arrays. Carry out an initial object-oriented design for the above specification, in which you should identify and show in a UML diagram: Classes that you think will be required. Their attributes and behaviours Any aggregation relationships Any other relationships between your classes The UML Diagram should show all the information of the classes up to and including the coordinator class. Please note that you must show or display competency in the techniques taught in the classes. Proper usage of concepts such as manager classes, coordinator classes, aggregation and responsibility delegation must be displayed in your design. The names and ID numbers of all group members must be in the diagram. You can use the website “draw.io” to do your design and export the image. This was shown in the recorded class.
Insert your UML diagram on the next page Insert your UML diagram after this line.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
CAREFUL NOTE: - Please safeguard your own team’s work. - You are to do this project with your group members only. - Note: Mobi Help members are NOT supposed to do or help you with your assignment.