Object Oriented Programming Concepts and Design Specifications

Verified

Added on  2023/06/10

|22
|3872
|249
AI Summary
This article discusses the principles and advantages of Object Oriented Programming (OOP) and Design Specifications for software development. It covers topics such as classes and objects, inheritance, data abstraction and encapsulation, and polymorphism. The advantages of OOP include code reusability, flexibility in modification, and maintenance of code. The article also includes a use case diagram and class diagram for a room carpet application. Course code, course name, and university are not mentioned.

Contribute Materials

Your contribution can guide someone’s learning journey. Share your documents today.
Document Page
Running head: ROOM CARPET APPLICATION
Room Carpet Application
Name of the student:
Name of the University:
Author note:

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
1
ROOM CARPET APPLICATION
Table of Contents
LO1 Object Oriented Programming Concepts...........................................................................2
1.1 Principles of Object Oriented Programming....................................................................2
1.2 Advantages of Object Oriented Programming.................................................................9
LO2 Design Specifications......................................................................................................10
2.1 Class and Object listing..................................................................................................10
Use Case Diagram................................................................................................................11
2.2 Class Diagram................................................................................................................12
LO3 Implementation................................................................................................................12
LO4 Testing Report..................................................................................................................15
4.1, 4.2 Testing Analysis......................................................................................................15
4.3 Review and Recommendations......................................................................................18
4.4 On-Screen help...............................................................................................................19
4.5 User Documentation.......................................................................................................19
Document Page
2
ROOM CARPET APPLICATION
LO1 Object Oriented Programming Concepts
Al-Bastami and Naser (2017), says that object oriented programming is a very
important concept of the application development techniques in the modern days. OOP or
object oriented programming is based on the use of classes, objects and member data or
methods in order to represent real life entities as programming modules. Classes and objects
are the pivot of OOP. They form the backbone of the entire program which is written using
this programming concept. Classes are the blueprints or plans that are created to standardize
the structure of the entities in a program. Objects on the other hand are the actual entities that
are inspired and created from the classes. The objects take up the data and the methods that
have been stated within the classes and they represent real life entities, accordingly (Dennis,
Wixom and Tegarden 2015). Each class can be used to create several objects of its own type.
These objects will carry all the data members and the member methods that have been
defined with in their respective classes. In general terms, it can be stated that these objects
inherit the behaviors and characteristics from their belonging class. These members of the
class or the objects is programmatically known as member variables and member methods.
The characteristic feature of an object is represented by the variables, whereas the member
methods represent the behaviors. Variables are used to carry values for the different
characteristic of the object and the methods are meant to perform different functions for the
objects. The methods are the keys to communicate with other objects and this is done through
the passing of the data members which are then processed and returned to the calling method.
1.1 Principles of Object Oriented Programming
Object Oriented Programming uses various features to enrich the development and
programming experience for the programmer (Clark and Sanders 2013). Below, the most
important object oriented programming features are mentioned and explained in details.
Document Page
3
ROOM CARPET APPLICATION
1. Classes and Objects: As discussed earlier, classes and objects are the two most basic
concepts of OOP that revolve around the various real life entities. Classes are the user
defined prototypes or blueprints that represent the base for the creation of several
objects from them. Clark and Sanders (2013), says that classes describe and represent
the set of methods or properties that are in general common to all the objects of the
similar type. A generalized class declarations will have the following components:
 Modifiers: Modifiers take care of the privacy factors involved with the
member data and methods of the programming modules. This can be public,
private or protected.
 Class name: Here the name of the class is presented. The class name should be
written based on the naming convention so as to evade any syntax errors.
 Superclass (if any): This is useful in the cases of inheritance. The parent class
is known as the superclass. It is mentioned in the class definition in case the
class adheres to the inheritance feature. The name of this parent class is further
preceded by the keyword extends. However, in Java, a class is allowed to
extend only one parent class at once.
 Interfaces: Comma-separated list of interfaces are often implemented by some
classed, if required. These are preceded by a keyword known as implements.
A class is allowed to implement several interfaces.
 Body: The body of the class is enclosed within the angular brackets or braces.
The body represents the data members and the member methods that the class
beholds and implements through its objects.
Examples:
1. class customer
2. {
3. // class members code

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
4
ROOM CARPET APPLICATION
4.
5. //Entry point
6. static void Main(string[] args)
7. {
8. // object instantiation
9. customer obj = new customer();
10.
11. //Method calling
12. obj.displayData();
13.
14. //fields calling
15. Console.WriteLine(obj.CustID);
16. Console.WriteLine(obj.Name);
17. Console.WriteLine(obj.Address);
18. }
19. }
Source: (C-sharpcorner.com1, 2018)
2. Inheritance: According to Zeigler (2014), inheritance is an object oriented
programming concept that allows the programmers to avoid coding redundancy.
Through the process of inheritance, classes within the same programming package is
allowed to access specified data from other classes residing there. This is carried out
by a group of parent and child classes. The child classes inherit the requisite data
members from their respective parent classes. The concept of inheritance helps to
provide a detailed hierarchical structure to the various classes that helps to instantiate
a real life programming situation. Inheritance is regarded as one of the most important
features of the OOP programming framework as it allows the re-usability of code.
Inheritance allows the modules and features that exists in the parent class can be
reused in another without the need for modifying it. This decreases space-complexity
of large programs as the same data can be initialized only once and not several times.
However, in the programming terms, only the public and the protected members of
the parent class are allowed to be inherited by the respective children classes. The
private members of the parent are solely its own to be used (Clark and Sanders 2013).
The details about these privacy access modifiers will be discussed in details in a later
section.
Document Page
5
ROOM CARPET APPLICATION
Examples:
1. public class Accountcreditinfo //base class
2. {
3. public string Credit()
4. {
5. return "balance is credited";
6. }
7. }
8. public class debitinfo : Accountcreditinfo //derived class
9. {
10. public string debit()
11. {
12. Credit(); ////derived class method
13. return "balance is debited";
14. }
15. }
Source: (C-sharpcorner.com2, 2018)
3. Data abstraction and encapsulation: Encapsulation is another crucial object oriented
programming feature, where several data members and member methods are put into
a single unit, which is the class. This wrapping up of data into a single unit is known
as encapsulation (Milanesi 2018). These members of the class are kept safe from the
external instances that may interfere or misuse the data and functionalities. Data
encapsulation further helps to implement the data hiding concept. The OOP languages
assist the classes in implementing explicit access limitations such as to label their
contained data to be protected from the outside world. This comes under the banner of
the data abstractio. Data abstraction, can therefore be explained as the process of
providing only the crucial information to the outside programming modules by
concealing the inner details of implementation.
Examples:
(Encapsulation)
class CellPhone
{
Document Page
6
ROOM CARPET APPLICATION
private int m_CellNetworkConnectionQuality;//let's say it is integer from 1 to
10
private int m_BatteryPercentage; //shows in percents battery status
from 1 to 100
public bool CallToPerson(string PersonsCellPhone)
{
//calling and return true
AddCallDataToLog();
return true;
}
public bool StopCurrentCall()
{
//stopping and return true
return true;
}
public bool AnswerInputCall()
{
//answering and return true
AddCallDataToLog();
return true;
}
public void GetPhoneStatus(out int NetworkStatus, out int BatteryStatus)
{
NetworkStatus = m_CellNetworkConnectionQuality;
BatteryStatus = m_BatteryPercentage;
}
private void AddCallDataToLog()
{
//adds call data to log
}
}
Source: (Kizyan, 2018)
4. Polymorphism: Polymorphism is another important object oriented programming
feature that allows the use of similarly named methods and class-constructors multiple
times. Polymorphism comes from the words ‘Poly Morphs’ in chemistry where poly
means multiple and morphs means forms. This signifies the feature that a particular
module can exist in more than one form. In the programming concepts, more than one
method can have the same name and yet act differently. To achieve this, these
functions needs to be provided with a varied set of parameters or arguments and
accordingly they will be licensed to be used differently (Milanesi 2018). The facility
for objects to access different functions of the same, differently also comes under this
topic. These two varied types of polymorphism are namely static polymorphism and

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
7
ROOM CARPET APPLICATION
dynamic polymorphism. Method overloading is the main example of static
polymorphism. Here several methods within a class can be used with the same name,
however there parameter list should be different and accordingly they can be made to
perform a variety of tasks. This form of polymorphism is also commonly known
compile time polymorphism as the compiler can determine which method to be called
by the caller statements, at compile time itself. Method overriding comes under the
concept of dynamic or run-time polymorphism. In this form of polymorphism, the
methods with the same name can be used in the inherited programming structure, that
is, parent class and child classes can have methods having same name, however are
different in functionalities. However, the calling of the methods will depend on the
object that is used to call it. An object of the child class will call the child class
method whereas an object of the parent class will access the functionalities of the
parent class by calling its method.
Examples:
Method Overloading (Static polymorphism)
1. public class TestData
2. {
3. public int Add(int a, int b, int c)
4. {
5. return a + b + c;
6. }
Document Page
8
ROOM CARPET APPLICATION
7. public int Add(int a, int b)
8. {
9. return a + b;
10. }
11. }
12. class Program
13. {
14. static void Main(string[] args)
15. {
16. TestData dataClass = new TestData();
17. int add2 = dataClass.Add(45, 34, 67);
18. int add1 = dataClass.Add(23, 34);
19. }
20. }
Source: (C-sharpcorner.com3, 2018)
In the above example, dataClass.Add(45, 34, 67); will call the method with the
method signature having 3 integer parameters whereas, the second call statement
dataClass.Add(23, 34); will access the dual parameterized method.
Method Overriding (Dynamic polymorphism).
1. public class Drawing
2. {
3. public virtual double Area()
4. {
5. return 0;
6. }
7. }
8.
9. public class Circle : Drawing
10. {
11. public double Radius { get; set; }
12. public Circle()
13. {
14. Radius = 5;
15. }
16. public override double Area()
17. {
18. return (3.14) * Math.Pow(Radius, 2);
19. }
20. }
21.
22. public class Square : Drawing
23. {
24. public double Length { get; set; }
25. public Square()
26. {
27. Length = 6;
28. }
29. public override double Area()
30. {
31. return Math.Pow(Length, 2);
32. }
33. }
34.
35. public class Rectangle : Drawing
Document Page
9
ROOM CARPET APPLICATION
36. {
37. public double Height { get; set; }
38. public double Width { get; set; }
39. public Rectangle()
40. {
41. Height = 5.3;
42. Width = 3.4;
43. }
44. public override double Area()
45. {
46. return Height * Width;
47. }
48. }
49.
50. class Program
51. {
52. static void Main(string[] args)
53. {
54.
55. Drawing circle = new Circle();
56. Console.WriteLine("Area :" + circle.Area());
57.
58. Drawing square = new Square();
59. Console.WriteLine("Area :" + square.Area());
60.
61. Drawing rectangle = new Rectangle();
62. Console.WriteLine("Area :" + rectangle.Area());
63. }
64. }
Source: (C-sharpcorner.com3, 2018)
Here, each object will call the Area() method of their respective classes and the
outputs will vary based on the different sets of commands that these methods contain.
1.2 Advantages of Object Oriented Programming
There are various advantages of the object oriented programming in the software
development:
Code Reusability: The OOP helps in reuse of code used in a programming. The code
used for defining an object needs to be shared with other objects in the programming. There
is a benefit of reuse of code has been used in the software development. There are huge lines
of codes included in a software. Therefore, reuse of code helps in minimizing effort if writing
same code repeatedly.

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
10
ROOM CARPET APPLICATION
Flexibility in the modification of an existing application: OOP helps in promoting
flexibility in the design and implementation of solution (Kelly 2016). The maintenance and
up gradation of codes and design of the software has been implemented in the application
development.
Maintenance of code: OOP helps in maintaining the quality of the code. OOP helps
in creating separate components of several requirements. However, a component in OOP s
known as class. Any internal change in the class does not affect the functionality of the other
class.
Improved software-development productivity: Object-oriented programming is a
modular approach that helps in providing duty separation in object based programming and
development. Objects can be extended in order to include new behaviors and attributes. This
makes it extensible. Cross-application access is also supported by the OOP objects. The use
of OOP has been helping maintaining the development of software (Smith 2015).
Inheritance: OOP supports inheritance in the mechanism of software development.
Inheritance deals with the mechanism in which one object acquires all the properties of parent
object. Details about the usefulness of inheritance in software development have been
elaborately discussed in a section above.
Modularity: Liang and Tsai (2013), states that OOP supports modularity in
developing software. Modularity deals with the concept of making of multiple modules and
linking them for complete system. There are huge lines of codes included in a software.
Therefore, reuse of code helps in minimizing effort if writing same code repeatedly. It helps
in enabling re-usability and minimizes duplication in the codes. This programming helps in
maintaining a package in the Java application (Mezini 2013).
Document Page
11
ROOM CARPET APPLICATION
LO2 Design Specifications
2.1 Class and Object listing
The program will require two main classes, RoomDimensions and RoomCarpet. The
other class, Calculator is used as the driving class for the entire program and the Price class is
used to maintain the calculating results of the program. The form1.cs class forms the home
screen interface that takes in the user inputs for the dimensions and calculates the area of each
room.
Use Case Diagram
Document Page
12
ROOM CARPET APPLICATION
2.2 Class Diagram
LO3 Implementation
Home page (Number of rooms entry)
Area calculator class

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
13
ROOM CARPET APPLICATION
Dimension class
Carpet class
Price class
Document Page
14
ROOM CARPET APPLICATION
Document Page
15
ROOM CARPET APPLICATION
LO4 Testing Report
4.1, 4.2 Testing Analysis
Testing
criteria
Reason Expected
Output
Actual Output Success
analysis
No. of
rooms =
-9
Test
negative or
zero inputs
Error
message
Yes
No. of
rooms =
3
Testing for
a valid
input
Proceed
to the
area entry
section.
Yes

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
16
ROOM CARPET APPLICATION
Length
= 0
Width =
0
Testing for
dimension
values as 0
Display
error
message
Yes
Length
= 10
Width =
7
Testing for
genuine
integer
inputs
Area= 70 Yes
Length
= 10.5
Width =
8.2
Testing for
genuine
floating
inputs
Area=
86.10
Yes
3rd room
area
Testing if
room areas
are
calculated
for 3 rooms
only or
Proceed
to Price
calculator
Yes
Document Page
17
ROOM CARPET APPLICATION
more.
Price = -
9
Testing if
system can
check for 0
or lesser
price value.
Display
error
message
Yes
Price =
12.0
Testing for
integer
price values
Result
displayed
properly
Yes
Price=
90.50
Testing for
individual
room area
display
with
floating
price value
Individual
prices=
$6335,
$7792.05,
$9050;
Total
price = $
23177.05
Yes
Document Page
18
ROOM CARPET APPLICATION
4.3 Review and Recommendations
Reviewer 1:
Name: Jason Anderson
This person loved the interface of the application and the way he could use this
application to find the area and price of the rooms. He did not notice any such back-draws in
the application and hence made no special improvement recommendation.
Reviewer 2:
Name: Milley Vardey
She enjoyed the graphical representation of the application, especially the font and the
color used in the buttons and the sectional areas. She tested the application with a variety of
values and spotted no such functional bugs. However, she noticed one noticeable design flaw
in the application. She recommended that the individual price of each room must be
displayed in a larger space so as to help the users to view these data results more clearly.

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
19
ROOM CARPET APPLICATION
4.4 On-Screen help
4.5 User Documentation
The users are required to run the Carpet Company App.exe file in order to execute
and use the application. The users will be able to enter the number of rooms for which they
wish to calculate the areas and prices and then continue forward. They will require to enter
the dimensions of the rooms one by one and calculate the area for each. When the area
calculations for each room is over, they will be guided to the price calculation page. Here the
user can enter the price per sq. meter or the rooms and their individual area will be
accordingly calculated. Finally, the total price of all rooms combined will also be displayed.
The user can then choose to either make a new calculation or choose to quit the application.
Document Page
20
ROOM CARPET APPLICATION
References
Clark, D. and Sanders, J., 2013. Beginning C# object-oriented programming. Apress.
Cs.uccs.edu. (2018). [online] Available at:
http://www.cs.uccs.edu/~qyi/UTSA-classes/cs3723/slides/module-object.pdf [Accessed 7
Jun. 2018].
Dennis, A., Wixom, B.H. and Tegarden, D., 2015. Systems analysis and design: An object-
oriented approach with UML. John wiley & sons.
DereziƄska, A. and Rudnik, M., 2012, May. Quality evaluation of object-oriented and
standard mutation operators applied to C# programs. In International Conference on
Modelling Techniques and Tools for Computer Performance Evaluation(pp. 42-57). Springer,
Berlin, Heidelberg.
Singh, C, Java, C., I/O, J., and. Tutorial, C. (2018). Inheritance in Java Programming with
examples. [online] beginnersbook.com. Available at:
https://beginnersbook.com/2013/03/inheritance-in-java/ [Accessed 7 Jun. 2018].
Kelly, S., 2016. Object-Oriented Programming. In BlitzMax for Absolute Beginners (pp. 101-
114). Apress, Berkeley, CA.
Kulak, D. and Guiney, E., 2012. Use cases: requirements in context. Addison-Wesley.
Larman, C., 2012. Applying UML and Patterns: An Introduction to Object Oriented Analysis
and Design and Interative Development. Pearson Education India.
Lengstorf, J. and Wald, K., 2016. Object-Oriented Programming. In Pro PHP and
jQuery (pp. 85-114). Apress, Berkeley, CA.
Liang, Y.D. and Tsai, M.J., 2013. Introduction to Java programming: brief version. Pearson.
Document Page
21
ROOM CARPET APPLICATION
Madduri, V., Singh, C., Singh, C. Java, C., I/O, J., Tutorial, C., Singh, C., m, j., and kumar,
A. (2018). Polymorphism in Java with example. [online] beginnersbook.com. Available at:
https://beginnersbook.com/2013/03/polymorphism-in-java/ [Accessed 7 Jun. 2018].
Mezini, M., 2013. Variational Object-Oriented Programming Beyond Classes and
Inheritance (Vol. 470). Springer Science & Business Media.
Milanesi, C., 2018. Object-Oriented Programming. In Beginning Rust (pp. 273-294). Apress,
Berkeley, CA.
Smith, B., 2015. Object-oriented programming. In Advanced ActionScript 3 (pp. 1-23).
Apress, Berkeley, CA.
Yuffa, A.J. and Scales, J.A., 2012. Object-oriented electrodynamic S-matrix code with
modern applications. Journal of Computational Physics, 231(14), pp.4823-4835.
Zeigler, B.P., 2014. Object-oriented simulation with hierarchical, modular models:
intelligent agents and endomorphic systems. Academic press.
1 out of 22
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]

Your All-in-One AI-Powered Toolkit for Academic Success.

Available 24*7 on WhatsApp / Email

[object Object]