Você está na página 1de 16

INDIVIDUAL ASSIGNMENT

TECHNOLOGY PARK MALAYSIA


CT038-3-2-OODJ
OBJECT-ORIENTED DEVELOPMENT WITH JAVA
UC2F1404 INT/IT/SE/TC

Hand In Date

28th August 2014

Name

Lim Keng Liang

Student ID

TP028092

Lecturers Name

Mr. Vazeerudeen Abdul Hameed

Contents
1.0 Introduction.......................................................................................................... 3
1.1 Use Case Diagram................................................................................................ 4
2.0 Use Case Specifications........................................................................................ 5
Order Class Diagram............................................................................................... 5
Invoice Class Diagram............................................................................................. 5
Engineer Class Diagram.......................................................................................... 6
Customer Class Diagram......................................................................................... 6
3.0 System Implementation....................................................................................... 7
Classes and Objects................................................................................................ 7
Inheritance.............................................................................................................. 7
4.0 User Interface....................................................................................................... 8
4.1 Admin Login...................................................................................................... 8
5.0 Object Oriented Concepts..................................................................................11
5.1 Objects............................................................................................................... 11
5.2 Classes............................................................................................................... 12
5.3 Inheritance......................................................................................................... 12
5.4 Encapsulation..................................................................................................... 13
5.5 Advantages of using Object Oriented Programming...........................................14
6.0 Conclusion.......................................................................................................... 14

1.0 Introduction
INSPECT-RICALS is an electrical contracting company whose business areas involve domestic
electrical wiring and installation services. The firm provides installation and inspection services
of wiring and electricity circuits within an apartment or condominium. Hence, the firm requires a
system to help record customer details, assign tasks, generate invoices and other fields that the
company sees fit.
In this system, there are four types of login classifications, mainly administrator, managers,
clerks and engineers. Each has different accessibility and user management functions depending
on the type of user that is logged in. Each user is to his or her own account and has an equal
share in responsibility in the company.
In the documentation, Object Oriented Programming Concepts will be explained, accompanied
with sample codes that will be used in the system. UML diagrams such as class diagrams and use
case diagrams will be shown in the documentation for more thorough explanation and data
representation.

1.1 Use Case Diagram

Based on the use case diagram as shown above, there are four actors or users that are involved
in the Electrical Installation and Inspection Management System directly, which are
administrator, clerk, manager and engineer. There is generalization in relationships between
actors, as shown in the manager actor, who inherits his functions from the admin actor.

2.0 Use Case Specifications


Order Class Diagram
Order
-order: int
-date: int
-NoRooms: int
-Followup: int
-TAppliance: String
-TService: String
- time : String
+ Order (String time, long IC, int orderNo, int Date, String cName, String cAdd, int NoRooms,
int EID,String TAppliance, String EngName, int Followup, String TService)
+ getFollowup () : int
+ getNoRooms () : int
+ gettime () : String
+ getorderNo () : int
+ getdate () : int
+ getTService () : String
+ getTAppliance () : String

Invoice Class Diagram


Invoice
- invoiceNo : int
- invStatus : String
+ Invoice (int invoiceNo, String invStatus, int orderNo, String time, long IC, int date, String
cAdd, int NoRooms, int EID, String TAppliance, String EngName, int Followup, String
TService)
+ getinvoiceNo() : int
+ getinvStatus() : String

Engineer Class Diagram


Engineer
- EngineerName : String
- EngineerID : int
+ Engineer (String EngineerName, int EngineerID)
+ getEngineerName() : String
+ getEngineerID() : int

Customer Class Diagram


Customer
- custIC : long
- custName : String
- custAdd : String
- custph : String
- custemail : String
+ Customer (Long custID, String custph, String custName, String custAdd, String custemail)
+ getcustemail () : String
+ getcustph () : String
+ getcustIC () : long
+ getcustName () : String

3.0 System Implementation


Classes and Objects

Inheritance

4.0 User Interface


4.1 Admin Login

Figure 4.1.1 Admin HomePage

Figure 4.2.2 Customer Information

Figure 4.2.3 User Management

5.0 Object Oriented Concepts


An object is a software bundle that is of related state and behavior. A class is a prototype from
which objects are derived from. Object Oriented Programming is a type of programming in
which programmers define the data type of a data structure and also the operations carried out or
that can be applied to the data structure. The main purpose of Object Oriented Programming is to
enable objects that can interact with other objects to create a different result.
There are many reasons for programmers to choose Object Oriented Programming. Below are
some of the prime examples of why Object Oriented Programming is favoured:
1. Evolution as technology continues to evolve, so does programming. This applies to
Object Oriented Programming as well. Despite the rapid development, there is still much
to learn about Object Oriented Programming.
2. Basic Understanding- the more a user uses Object Oriented Programming, the better a
user will be.
3. Ease of Access-Object Oriented Programming is easier to use and access compared to
other programming techniques.

5.1 Objects
Objects are based off models or a concept similar to real life. Each real life object has its own
characteristics and behaviors, examples being humans who are not identical, despite maybe
having similar surnames.
Objects in Object Oriented Programming are similar to that. The only difference being that
objects in OOP are abstract and non-existent, but they still can be used to simulate real life
features in a system.
An object that has many occurrences can be written once, and then duplicated, making OOP
favoured because the written code can be reused or altered to be used in another system or
function.

5.2 Classes
In Object Oriented Programming, a class is a collection of objects that have the same common
properties. Every object must be specified to a class. The main purpose of a class is to provide
structure for objects created in the system, as all objects have shape, meaning they are set values
that can represent something in the real life if group together.
A class has mainly two parts, mainly the header and the body. The class header will always
include the word class in the hardcodes followed by the name of the class, which can be named
as the user sees fit. This is to help differentiate and identify classes and their properties.

5.3 Inheritance
Inheritance is the extension of one class by another class. In the process, the
inheriting class obtains all data and information as well as the methods from the
parent class, also known as the super class. The child class can redefine functions it
has inherited from its parent class.

Each
only
class,
class

classes.
using
coding
of code
class
the
makes
lot
code is
times.

5.4 Encapsulation

child class has


one parent
but a parent
can have
multiple
inheritances,
meaning
multiple child
Benefits of
inheritance in
are the reusage
from the parent
which was
inherited into
child class. This
coding work a
simpler as the
reused multiple

Encapsulation is the method of packing functions and data types into a single component, hence
the term encapsulation. In programming terms, encapsulation is packing functions and data types
to secure its integrity. Encapsulation has three different security levels, namely private, protected
and public.
Encapsulation is used in the declaration of a private class. Once a class is declared private, it is
not accessible by anyone outside the class. The access of the private class can only be done by
using public methods or class constructors. This method is also known as data hiding.
For protected encapsulation, only a set number of classes and classes inheriting from said class is
able to access the data and functions in that class, whereas in public, any function can access the
class.
The benefits of using encapsulation include anonymity when modifying case sensitive objects,
such as ID and password of a system. Encapsulation also provides security as private classes
cannot be accessed and altered by third party members.

5.5 Advantages of using Object Oriented Programming


Below are some of the reasons why Object Oriented Programming is favoured by programmers:
1. Maintenance- allows easy maintenance and to edit or alter existing codes or projects if
they are to be of use later in the future.
2. Reusing of codes- Codes that have been created in the past can be reused when creating a
new project as the object contains the key components of both data and function. This
method is known as encapsulation
3. Time factor Reusing of codes means less work for programmers, meaning it is efficient
and effective at the same time, as a program can be developed faster
4. Modular structure- easy to understand skeleton of program, meaning easier to define
abstracts in codes where implementation and case sensitive codes are hidden.

6.0 Conclusion
There is plenty to learn from completing this assignment. One of the main concepts is object
oriented programming, with samples such as encapsulation and inheritance. By using a GUI
interface it makes the system so much more usable and understandable. Programmers are able to
focus on the design of a system to give the user a better sense of understanding on how a system
works.
In conclusion, object oriented is easier to develop and has better GUI applications. It is worth
leaning and applying to a system whether large scale or smaller scale.

Você também pode gostar