Assignment 1
Student name and surname Charmain Smit
Student number PT2015-0300
Subject Object-Oriented Programming
Subject code ITOO121
Assignment number 1
Submission date 19 September 2015
Lecturer Susan Snyman
Table of Contents
INTRODUCTION 3
TASK 1 4
Task 1.1 Encapsulation 4
Task 1.2 Attributes 6
Task 1.3 Inheritance 8
TASK 2 11
Task 2.1 Class Diagram 11
Task 2.2 CRC Diagram 12
Task 2.3 Calculator Application 13
CONCLUSION 16
BIBLIOGRAPHY 17
INTRODUCTION
In this assignment there will be discussed what encapsulation means and an example will be given on what it looks like, there is also three attributes that will be discussed and explained.
In this assignment there will be a program written about …show more content…
With the help of stack overflow I got a baseline on how to start with my code (Stackoverflow.com, 2015).
TASK 1
Task 1.1 Encapsulation
Encapsulation is one of the four fundamental object oriented programming concepts, it is also called data hiding (Tutorialspoint.com, 2015). Encapsulation is when a programmer (while creating the system/project) makes restrictions or hide data from/for people such as what the user can access and not access or what the user sees as useful. The use of encapsulation is also to decrease the burden on programmers when dealing with the code (Javaken.com, 2015). The benefits of encapsulation are
• Maintenance is better when using encapsulation.
• If you need to change the code you can do it independently.
• The usability of it is increased.
(Sa, 2015).
An example of encapsulation: (Beginnersbook.com, 2015).
Task 1.2 Attributes
Attributes are a part of a class diagram and attributes represent the state of an object inside a class (Weisfeld, 2015). There are three types of attributes:
• Local