Академический Документы
Профессиональный Документы
Культура Документы
2|Page
Acknowledgment
I would like to express my special thanks to Mr.U.H.Samarawickrama, the lecture of object oriented
programming.
As well as I would like to thank my Parents and my friends who help me to do this wonderful Assignment
on the topic, ‘object oriented programming.’ which also helped me in doing a lot of Research and I came
to know about so many new things and helped me to complete this assignment within the limited time
frame.
Table of Contents
Task1 2
1.1 What are the Main characteristics and Features of Object Oriented Programming? Explain with
suitable diagrams…………………………………………………………………………………………………………………………. 2
1.2 Explain the Difference between Class & Object with in Object Oriented Programming with
Examples……………………………………………………………………………………………………………………………….. 6
Task 2………………………………………………………………………………………………………………………………....... 12
2.1Draw Class Responsibility Collaboration (CRC) cards keeps the complexity of the design at a
minimum………………………………………………………………………………………………………………………………. 12
Task 3…………………………………………………………………………………………………………………………………….. 26
3.2Implement a client class with a main(), that calls operations in the Systems Manger
class……………………………………………………………………………………………………………………………………………… 31
Task 4………………………………………………………………………………………………………………………………………….. 32
4.1 Test implemented object oriented solution by using test mechanisms (valid declarations, debugging
code, and comment code) and types (range testing, input testing, load testing, and system
compatibility)………………………………………………………………………………………………………………………… 32
4.2 Error handling during software testing and give a feedback to improve the developed object
oriented solution…………………………………………………………………………………………………………………………..37
4.4 Create technical documentation to include designs, delivery system, platform, environment, file
structures, coding, constraints, and maintenance
requirements……………………………………………………………………………………………………………………………….. 39
Task 5…………………………………………………………………………………………………………………………………………… 45
5.1 Create a documentation according to the standards which covers all tasks Task 1 –Task 5…65
References…………………………………………………………………………………………………………………………………… 73
4|Page
5|Page
Task 1
1.1 What are the Main characteristics and Features of Object Oriented
Programming? Explain with suitable diagrams.
1. Encapsulation
2. Abstraction
3. Inheritance
4. Polymorphism
5. Data hiding
1. Encapsulation
Encapsulation implies that the non-essential details of an object are hidden from the user
and an access is provided to its essential details. Therefore, encapsulation is also called
information hiding. For example, when you plug in the cord of a vacuum cleaner and switch
it on, the vacuum cleaner starts functioning. An end-user need not know the working
principle of a vacuum cleaner to convert electricity into suction power. The switch of th6
vacuum cleaner encapsulates the complex process of conversion of electricity into suction
power. The complexity of an object is hidden as a result of encapsulation.
Computer games also use the feature of encapsulation. The user only needs to know how
to play the game. However, the complex working of game is hidden from the user.
6|Page
2. Abstraction
Abstraction refers to the attributes of an object that clearly demarcates it from other
objects. For example, while developing an online shopping site for books, you use objects of
various items, such as books, compact disks (CDs), and cassettes. All these objects have a
well-defined set of attributes that distinguish these objects from each other. For example, a
book has page numbers, type of binding, and subject. However, a CD has type of media,
such as audio or visual, duration, and storage capacity of the CD.
Similarly, when you want to send e-mail messages, you should know the processes of
writing e-mail messages and sending it to the receiver. However, it is not necessary for you
to know the entire process of sending the e-mail messages across the network.
To implement abstraction, you also use the encapsulation feature. Encapsulation hides the
irrelevant details of an object and abstraction makes only the relevant details of an object
visible. For example, the operation of a washing machine is hidden or encapsulated from
the user. The details, like switching on and off the washing machine are the only details
relevant for the user to know. This is implemented by abstraction. Rest of the working of
the washing machine is encapsulated from the user.
3. Inheritance
For example, you might have the Student class that consists of the basic
characteristics of students, such as name, date of birth, and gender. You can extend
the functions of the student class to a day scholar, who in addition to
characteristics of the Student class contains its own features, such as locker
number and residential address.
Inheritance enables you to add new features and functionality to an existing class
without modifying the existing class. Inheritance also enables you to share data and
methods among multiple classes.
4. Polymorphism
Polymorphism is derived from two Latin words-Poly, which means many, and morph, which
means forms. Anything that exists in more than one form is known as a polymorph. You might
have noticed that a person assumes different roles in different scenarios. For example, a person
assumes various roles when he interacts with the members of his family. He is a father to his
children, child to his parents, and husband to his wife. Although, the person is same, he behaves
differently with the family members as per his relation with the member.
8|Page
5. Data hiding
Data hiding is a method used in OOP to hide information within computer code. Objects within a
code are not privy to information considered hidden. It presents several advantages for
programmers, because objects are unable to connect to irrelevant data and hackers are less
likely to be able to access data. At the same time, hiding data can make it harder for a
programmer, who may need to use more code to create effects in hidden data than would be
necessary if the data were public.
Object-oriented programming is a type of programming in which parts of the code are split into
objects. Each of these objects is programmed in capsules, so each object has its own coding that
applies only to that object. Without specifying data as hidden, all the data is open to the objects.
Data hiding takes certain parts of code and hides those parts from the objects. The objects
cannot directly access any data that is hidden. If an object does access hidden data, it will return
an error. This is because the object cannot see the data, so any functions or data that are
labeled as hidden will look invisible to the object. Most of the time, the data being hidden are
the internal components that are not needed by the user and can prove dangerous if the data
are laid open for the user.
1.2 Explain the Difference between Class & Object with in Object Oriented Programming with
Examples
Object-Oriented Characteristics
Abstraction is to focus on the essential and discard the irrelevant. In a way this does
not make sense unless you have a scope. Example in the image above the vet is a
doctor of animals her view of the cat that is important to her would be the parts of
the cat while thing like the cat favorite toy might not be of relevance to her.
Whereas for the owner of the cat her view of the cat is different from the Vet.
Encapsulation is hiding the unnecessary. Meaning things that you do not want other
people/classes to know are to be hidden. For example in the image the professor do not need
to know how a student does her assignment. He is more interested in the end product.In a way
encapsulation protect the system, since it hides stuff that can be vulnerable to malicious attack.
There are also many other drawbacks to create a system without encapsulation. You can find it
out in our book chapter.
Similarities often exist in the world. As shown in image above, one could easily see
that there are some similarities between the two President of United States, George
H.W Bush (41st President) and George W. Bush (43rd President).
George W. Bush is a son of George H.W Bush. He inherits biological features from
his father, at the same time, has his own unique feature that one could identify him
as George W. Bush. This bring us to the idea of inheritance that models a “is a”
relationship between objects.
Source http://technofriends.in/2008/02/06/polymorphism-in-java-part-1/.
The word “Polymorphism” comes from two Greek words, “many” and “form”. We can
illustrate the idea of polymorphism easily using the scenario where different animals are
asked to “speak”. As you can see from the image above, each animal has their own way
11 | P a g e
of “speaking”. So, when the person asks all the animals to “speak”, every animal
responds in their own way. This illustrates the power of polymorphism where different
instances can be treated the same way.
Example diagram for show the difference between of class and object
Class Object
Task 02
2.1 Draw Class Responsibility Collaboration (CRC) cards keeps the complexity of the design at a
minimum.
Systems Manager
Manager ID City
Create Room
Find Available
Rooms
Book Room
Display System
Details
13 | P a g e
City
Hotel
Systems
Name Manager
City
Room
Room
Hotel
14 | P a g e
Room Type
2.2 Draw a class diagram which can show the relationship between classes.
Class Diagram
15 | P a g e
Hotel M 1 City
-hotelName -cityName : string = 5
M
M M M
M 1
Systems Manager
Room M 1
-ManagerID : int
-roomID : int
-ManagerName : string
-roomType : int
1 +createCity()
+createHotel()
+createRoomType()
M M +createRoom() : any(idl)
+findAvailableRoom()
+bookRoom()
1 Room Type +displaySystemDetails()
-typeID : int
Task 03
16 | P a g e
FriendClassfrmReservation
Inherits System.Windows.Forms.Form
cnHotel = NewOleDbConnection
Try
17 | P a g e
With cnHotel
If .State = ConnectionState.Open Then .Close()
.ConnectionString = cnString
.Open()
EndWith
Catch ex AsOleDbException
MsgBox(ex.ToString)
EndTry
IsInitializing = True
cboVehicle.Text = ""
GeneratePK()
Try
Dim rdr AsOleDbDataReader = cmd.ExecuteReader
18 | P a g e
While (rdr.Read)
If RecordCount > 0 Then
txtRate.Text = rdr("RoomRate").ToString()
txtAdults.Text = rdr("NoofPerson").ToString()
hsAdults.Minimum = rdr("NoofPerson").ToString()
hsAdults.Value = rdr("NoofPerson").ToString()
txtAdults.Tag = rdr("ExtraAdultRate").ToString()
txtChildrens.Tag = rdr("ExtraChildRate").ToString()
EndIf
EndWhile
cboBusinessSource.SelectedValue = 2
daReservation.Fill(dsReservation, "Reservation")
Catch ex AsOleDbException
MsgBox(ex.ToString)
Finally
cnHotel.Close()
EndTry
CallComputeRate()
ElseIf State = modGlobal.FormState.adStateEditMode Then
Dim sqlQRY As String = "SELECT * FROM [Room_Rates] WHERE Room Number = "&
cboRoomNumber.SelectedValue &" AND RateTypeID = "& cboRateType.SelectedValue
Dim cmd AsOleDbCommand = NewOleDbCommand(sqlQRY, cnHotel)
Dim Record Count As Integer
Record Count = Count Rows ("SELECT Count (*) FROM [Room Rates]")
Try
Dim rdr AsOleDbDataReader = cmd.ExecuteReader
19 | P a g e
While (rdr.Read)
If RecordCount > 0 Then
txtRate.Text = toMoney(rdr("RoomRate").ToString)
hsAdults.Minimum = rdr("NoofPerson").ToString
txtAdults.Tag = rdr("ExtraAdultRate").ToString
txtChildrens.Tag = rdr("ExtraChildRate").ToString
EndIf
EndWhile
daReservation.Fill(dsReservation, "Reservation")
txtReservationNo.Text = dt.Rows(0)("ReservationNo")
txtLastName.Text = GetFieldValue("SELECT LastName FROM Customers WHERE
CustomerID = "& dt.Rows(0)("CustomerID"), "LastName")
txtFirstName.Text = GetFieldValue("SELECT FirstName FROM Customers WHERE
CustomerID = "& dt.Rows(0)("CustomerID"), "FirstName")
txtAddress.Text = dt.Rows(0)("Address")
cboCountry.SelectedValue = dt.Rows(0)("CountryID")
IfNotIsDBNull(dt.Rows(0)("CompanyID")) Then txtCompany.Text = GetFieldValue("SELECT
Company FROM Company WHERE CompanyID = "& dt.Rows(0)("CompanyID"), "Company")
cboIDType.SelectedValue = dt.Rows(0)("IDTypeID")
txtIDNumber.Text = dt.Rows(0)("IDNumber")
cboRoomNumber.SelectedValue = dt.Rows(0)("RoomNumber")
dtpDateIn.Value = dt.Rows(0)("DateIn")
If State = modGlobal.FormState.adStateAddMode Or State =
modGlobal.FormState.adStateEditMode Then
Ifdt.Rows(0)("DateOut") >= Today Then
dtpDateOut.Value = dt.Rows(0)("DateOut")
20 | P a g e
Else
dtpDateOut.Value = dt.Rows(0)("DateOut")
EndIf
cboRateType.SelectedValue = dt.Rows(0)("RateType")
txtRate.Text = toMoney(dt.Rows(0)("Rate"))
txtOtherCharges.Text = toMoney(dt.Rows(0)("OtherCharges"))
txtDiscount.Text = dt.Rows(0)("Discount")
txtAmountPaid.Text = toMoney(dt.Rows(0)("AmountPaid"))
txtAdults.Text = dt.Rows(0)("Adults")
txtChildrens.Text = dt.Rows(0)("Childrens")
txtDays.Text = dtpDateOut.Value.Subtract(dtpDateIn.Value).Days.ToString
' dtpDateOut.Value - dtpDateIn.Value 'dt.Rows(0)("Days")
cboBusinessSource.SelectedValue = dt.Rows(0)("BusinessSourceID")
cboVehicle.SelectedValue = dt.Rows(0)("VehicleID")
txtVehicleModel.Text = dt.Rows(0)("VehicleModel")
txtPlateNo.Text = dt.Rows(0)("PlateNo")
txtNotes.Text = dt.Rows(0)("Notes")
hsDays.Value = txtDays.Text
hsAdults.Value = txtAdults.Text
hsChildrens.Value = txtChildrens.Text
btnCheckIn.Visible = True
btnPrint.Visible = True
btnCancel.Visible = True
'Call txtDays_TextChanged(sender, e)
21 | P a g e
CallComputeRate()
Catch ex AsOleDbException
MsgBox(ex.ToString)
Finally
cnHotel.Close()
EndTry
EndIf
IsInitializing = False
EndSub
Exit Sub
EndIf
CallSaveRecord(sender, e)
FolioNumber = CStr(GetIndex("Reservation"))
FolioNumber = GenerateID(FolioNumber, Format(Today, "yy") &"-", "00000")
Notes, ReservedBy, "& CurrUser.USER_PK &", "& CurrUser.USER_PK &" "&"FROM Reservation
"&"WHERE ReservationNo='"& txtReservationNo.Text &"'")
CallAddRatePerPeriod(FolioNumber)
PrivateSubComputeRate()
If txtAdults.Tag = ""ThenExit Sub
txtTotalCharges.Text = CStr((CDbl(toMoney(txtRate.Text)) *
toNumber(txtDays.Text)) + (CDbl(toMoney(txtAdults.Tag)) * intAdults) +
(CDbl(toMoney(txtChildrens.Tag)) * toNumber(txtChildrens.Text)))
txtTotalCharges.Text = toMoney(txtTotalCharges.Text)
txtSubTotal.Text = toMoney(CStr(toNumber(txtTotalCharges.Text) +
toNumber(txtOtherCharges.Text)))
txtTotal.Text = toMoney(CStr(toNumber(txtSubTotal.Text) -
(toNumber(txtSubTotal.Text) * toNumber(txtDiscount.Text) / 100)))
txtBalance.Text = toMoney(CStr(toNumber(txtTotal.Text) -
toNumber(txtAmountPaid.Text)))
EndSub
EndIf
txtDays.Text = dtpDateOut.Value.Subtract(dtpDateIn.Value).Days.ToString
hsDays.Value = txtDays.Text
CallComputeRate()
EndSub
Exit Sub
EndIf
If CustomerID = 0 Then
CustomerID = GetIndex("Customers")
ExecNonQuery("INSERT INTO Company (CompanyID, Company) Values ("& CompanyID &", '"&
txtCompany.Text &"')")
EndIf
EndIf
newRow = dt.NewRow()
newRow("ReservationNo") = txtReservationNo.Text
newRow("Status") = "Reserved"
newRow("DateAdded") = Now()
'newRow("ReservedBy") = CurrUser.USER_PK
'newRow("AddedByFK") = CurrUser.USER_PK
dt.Rows.Add(newRow)
Else
dt.Rows(0)("DateModified") = Now
'dt.Rows(0)("LastUserFK") = CurrUser.USER_PK
EndIf
Withdt
.Rows(0)("CustomerID") = CustomerID
25 | P a g e
.Rows(0)("Address") = txtAddress.Text
.Rows(0)("CountryID") = cboCountry.SelectedValue
.Rows(0)("CompanyID") = CompanyID
.Rows(0)("IDTypeID") = cboIDType.SelectedValue
.Rows(0)("IDNumber") = txtIDNumber.Text
.Rows(0)("RoomNumber") = IIf(cboRoomNumber.Text = "", System.DBNull.Value,
cboRoomNumber.SelectedValue)
.Rows(0)("DateIn") = dtpDateIn.Value
.Rows(0)("DateOut") = dtpDateOut.Value
.Rows(0)("RateType") = cboRateType.SelectedValue
.Rows(0)("Rate") = txtRate.Text
.Rows(0)("OtherCharges") = txtOtherCharges.Text
.Rows(0)("Discount") = txtDiscount.Text
.Rows(0)("AmountPaid") = txtAmountPaid.Text
.Rows(0)("Days") = txtDays.Text
.Rows(0)("Adults") = txtAdults.Text
.Rows(0)("Childrens") = txtChildrens.Text
.Rows(0)("Total") = txtTotal.Text
.Rows(0)("BusinessSourceID") = cboBusinessSource.SelectedValue
.Rows(0)("VehicleID") = IIf(cboVehicle.Text = "", System.DBNull.Value,
cboVehicle.SelectedValue)
.Rows(0)("VehicleModel") = txtVehicleModel.Text
.Rows(0)("PlateNo") = txtPlateNo.Text
.Rows(0)("Notes") = txtNotes.Text
daReservation.Update(dsReservation, "Reservation")
EndWith
'Delete record from Inventory and add a new check in/out date
ExecNonQuery("DELETE ID, Status "&"From [Inventory] "&"WHERE ID='"& txtReservationNo.Text
&"' AND Status='Reservation'")
dtpStartDate = dtpDateIn.Value
dtpStartDate = System.DateTime.FromOADate(dtpStartDate.ToOADate + 1)
Loop
blnSaved = True
EndSub
txtDays.Text = hsDays.Value.ToString
CallComputeRate()
EndSub
CallComputeRate()
EndSub
CallComputeRate()
EndSub
txtLastName.Text = CurrCust.Lastname
txtFirstName.Text = CurrCust.Firstname
EndWith
EndSub
txtCompany.Text = CurrCust.Company
EndWith
EndSub
tmpDate = dtpDateIn.Value
28 | P a g e
Dim qry AsString = "SELECT * FROM Rate_Per_Period WHERE FolioNumber = '"& FolioNumber &"'
ORDER BY DateIn"
Try
Dim da AsNewOleDbDataAdapter()
da.SelectCommand = NewOleDbCommand(qry, cnHotel)
Dim ds AsNewDataSet()
da.Fill(ds, "Rate_Per_Period")
newRow("FolioNumber") = FolioNumber
newRow("DateIn") = tmpDate
newRow("RoomNumber") = cboRoomNumber.SelectedValue
newRow("RateTypeID") = cboRateType.SelectedValue
newRow("Rate") = txtRate.Text
newRow("Adults") = CDbl(txtAdults.Tag) * intAdults
newRow("Childrens") = CDbl(toMoney(txtChildrens.Tag)) * toNumber(txtChildrens.Text)
29 | P a g e
dt.Rows.Add(newRow)
tmpDate = System.DateTime.FromOADate(tmpDate.ToOADate + 1)
Loop
da.Update(ds, "Rate_Per_Period")
Catch ex AsOleDbException
MsgBox(ex.ToString)
Finally
cnHotel.Close()
EndTry
EndSub
'Me.Close()
ElseIf State = modGlobal.FormState.adStateEditMode And blnSaved = TrueThen
MsgBox("Changes in record has been successfully saved.", MsgBoxStyle.Information)
'Me.Close()
EndIf
EndSub
frmReports.ShowDialog()
EndWith
EndSub
EndClass
Imports System.Data.OleDb
PublicClassfrmCheckOut
Inherits System.Windows.Forms.Form
ExecNonQuery("INSERT INTO [Rate Per Period] "&"SELECT [Rate Per Period Temp].*
"&"FROM [Rate Per Period Temp] "&"Where ((([Rate Per Period Temp].FolioNumber) = '"&
txtGuestName.Tag &"')) "&"ORDER BY [Rate Per Period Temp].Date;")
Me.Close()
EndSub
Exit Sub
EndIf
CallfrmPayments.SaveRecord()
CallfrmOtherCharges.SaveRecord()
Withdt
'Delete record from Inventory
ExecNonQuery("DELETE ID, Status "&"From [Inventory] "&"WHERE ID='"&
.Rows(0)("FolioNumber") &"' AND Status='Check In'")
.Rows(0)("DateOut") = dtpDateOut.Value
32 | P a g e
.Rows(0)("OtherCharges") = txtOtherCharges.Text
.Rows(0)("Discount") = txtDiscount.Text
.Rows(0)("AmountPaid") = txtAmountPaid.Text
.Rows(0)("Days") = txtDays.Text
Debug.Print(.Rows(0)("Status"))
CallPrintFolio()
Me.Close()
EndSub
PrivateSubPrintFolio()
'With frmReports
' .strReport = "Folio"
' frmReports.ShowDialog()
'End With
EndSub
dtpDateOut.Focus()
EndIf
EndSub
33 | P a g e
EndSub
cnHotel = NewOleDbConnection
Try
With cnHotel
If .State = ConnectionState.Open Then .Close()
.ConnectionString = cnString
.Open()
EndWith
Catch ex AsOleDbException
MsgBox(ex.ToString)
EndTry
txtRoomNumber.Text = CStr(RoomNumber)
dsTransactions.Clear()
daTransactions.Fill(dsTransactions, "Transactions")
Try
txtGuestName.Tag = dt.Rows(0)("FolioNumber")
txtGuestName.Text = GetFieldValue("SELECT [Name] FROM qry_CheckIn WHERE
FolioNumber = '"& dt.Rows(0)("FolioNumber") &" '", "Name")
dtpDateIn.Text = dt.Rows(0)("DateIn")
If AutoCheckOut = TrueThen
Ifdt.Rows(0)("DateOut") >= Today Then
dtpDateOut.Value = dt.Rows(0)("DateOut")
Else
dtpDateOut.Value = Today
EndIf
Else
dtpDateOut.Value = dt.Rows(0)("DateOut")
EndIf
cboRateType.SelectedValue = dt.Rows(0)("RateType")
txtDays.Text = dtpDateOut.Value.Subtract(dtpDateIn.Text).Days.ToString
txtAdults.Text = dt.Rows(0)("Adults")
txtChildrens.Text = dt.Rows(0)("Childrens")
txtRate.Text = dt.Rows(0)("Rate")
txtOtherCharges.Text = toMoney(dt.Rows(0)("OtherCharges"))
txtDiscount.Text = toMoney(dt.Rows(0)("Discount"))
txtAmountPaid.Text = toMoney(dt.Rows(0)("AmountPaid"))
Catch ex AsOleDbException
MsgBox(ex.ToString)
Finally
cnHotel.Close()
EndTry
cboRateType.Enabled = False
35 | P a g e
CallComputeAddRate()
CallComputeRate()
PrivateSubComputeRate()
txtTotalCharges.Text = toMoney(CStr(ComputeRatePerPeriod()))
txtSubTotal.Text = toMoney(CStr(toNumber(txtTotalCharges.Text) +
toNumber(txtOtherCharges.Text)))
txtTotal.Text = toMoney(CStr(toNumber(txtSubTotal.Text) -
(toNumber(txtSubTotal.Text) * toNumber(txtDiscount.Text) / 100)))
txtBalance.Text = toMoney(CStr(toNumber(txtTotal.Text) -
toNumber(txtAmountPaid.Text)))
EndSub
cnHotel = NewOleDbConnection
Try
With cnHotel
If .State = ConnectionState.Open Then .Close()
.ConnectionString = cnString
.Open()
EndWith
Catch ex AsOleDbException
MsgBox(ex.ToString)
EndTry
36 | P a g e
Dim sqlQRY AsString = "SELECT * FROM [Room_Rates] WHERE RoomNumber = "& RoomNumber &" AND
RateTypeID = "& cboRateType.SelectedValue
Dim cmd AsOleDbCommand = NewOleDbCommand(sqlQRY, cnHotel)
Dim RecordCount AsInteger
Try
Dim rdr AsOleDbDataReader = cmd.ExecuteReader
While (rdr.Read)
If RecordCount > 0 Then
txtRate.Text = toMoney(rdr("RoomRate"))
txtAdults.Tag = rdr("ExtraAdultRate")
txtChildrens.Tag = rdr("ExtraChildRate")
EndIf
EndWhile
Catch ex AsOleDbException
MsgBox(ex.ToString)
Finally
cnHotel.Close()
EndTry
EndSub
frmPayments = Nothing
EndSub
.RefForm = Me.Name
.ShowDialog()
txtAmountPaid.Text = toMoney(CStr(AmountPaid))
EndWith
EndSub
PrivateFunctionComputeRatePerPeriod() AsDecimal
Dim cnHotel AsOleDbConnection
cnHotel = NewOleDbConnection
Try
With cnHotel
If .State = ConnectionState.Open Then .Close()
.ConnectionString = cnString
.Open()
EndWith
While (rdr.Read)
ComputeRatePerPeriod = ComputeRatePerPeriod + CDbl(toMoney(rdr("Rate")))
+ CDbl(toMoney(rdr("Adults"))) + CDbl(toMoney(rdr("Childrens")))
EndWhile
Catch ex AsOleDbException
MsgBox(ex.ToString)
Finally
cnHotel.Close()
EndTry
EndFunction
38 | P a g e
.RefForm = Me.Name
.ShowDialog()
txtOtherCharges.Text = toMoney(CStr(OtherCharges))
EndWith
EndSub
.ShowDialog()
CallComputeRate()
EndWith
EndSub
tmpDate = CDate(dtpDateIn.Text)
39 | P a g e
Try
Dim da AsNewOleDbDataAdapter()
da.SelectCommand = NewOleDbCommand(qry, cnHotel)
Dim ds AsNewDataSet()
da.Fill(ds, "Rate_Per_Period")
newRow("FolioNumber") = txtGuestName.Tag
newRow("DateIn") = tmpDate
newRow("RoomNumber") = txtRoomNumber.Text
newRow("RateTypeID") = cboRateType.SelectedValue
newRow("Rate") = txtRate.Text
newRow("Adults") = CDbl(txtAdults.Tag) * intAdults
newRow("Childrens") = CDbl(toMoney(txtChildrens.Tag)) * toNumber(txtChildrens.Text)
dt.Rows.Add(newRow)
EndIf
tmpDate = System.DateTime.FromOADate(tmpDate.ToOADate + 1)
Loop
da.Update(ds, "Rate_Per_Period")
Catch ex AsOleDbException
MsgBox(ex.ToString)
Finally
cnHotel.Close()
EndTry
EndSub
CallComputeRate()
EndSub
EndClass
41 | P a g e
Payments Info
PublicClassfrmPayments
Public FolioNumber AsString
Public GuestName AsString
Public Balance AsDouble
Public RefForm AsString
PublicSubSaveRecord()
Me.Validate()
Me.PaymentsBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.HotelDataSet)
Me.Close()
EndSub
txtTotal.Text = Total().ToString("c")
42 | P a g e
EndSub
If RefForm = "frmCheckIn"Then
frmCheckIn.AmountPaid = txtTotal.Text
Else
frmCheckOut.AmountPaid = txtTotal.Text
EndIf
EndSub
PublicSubRefreshBalance()
EndSub
PrivateFunctionTotal() AsDouble
Dim tot AsDouble = 0
Dim i AsInteger = 0
For i = 0 To PaymentsDataGridView.Rows.Count - 1
tot = tot + Convert.ToDouble(PaymentsDataGridView.Rows(i).Cells("Amount").Value)
43 | P a g e
Next i
Return tot
EndFunction
EndClass
PublicClassfrmChangeRoom
Dim sSql AsString
CallFillList()
EndSub
PublicSubFillList()
With lvList
.Clear()
44 | P a g e
.View = View.Details
.FullRowSelect = True
.GridLines = True
.Columns.Add("Room Number", 90)
.Columns.Add("Room Type", 120)
.Columns.Add("Status", 90)
FillListView(lvList, GetData(sSql))
EndWith
EndSub
Exit Sub
EndIf
.txtRoomNumber.Text = txtTo.Text
.txtRate.Text = toMoney(GetFieldValue("SELECT RoomRate FROM [Room_Rates]
WHERE RoomNumber = "& .txtRoomNumber.Text &" AND RateTypeID = "&
.cboRateType.SelectedValue, "RoomRate"))
Call .dtpDateOut_ValueChanged(sender, e)
.blnChangeRoom = True
Me.Close()
EndWith
EndSub
45 | P a g e
EndClass
PublicClassfrmRoomStatus
EndSub
EndSub
EndClass
Company/Hotel Information
PublicClassfrmCompany
EndSub
47 | P a g e
EndSub
EndClass
Payment details
PublicClassfrmAccountReceivableList
Dim sSql AsString
CallFillList()
EndSub
With frmCheckIn
.State = modGlobal.FormState.adStatePopupMode
.FolioNumber = lvList.SelectedItems(0).Text
.ShowDialog()
CallFillList()
EndWith
frmCheckIn = Nothing
EndSub
lvList.Height = Me.Height - 96
lvList.Width = Me.Width - 10
EndIf
EndSub
PublicSubFillList()
With lvList
.Clear()
.View = View.Details
.FullRowSelect = True
.GridLines = True
.Columns.Add("AccRecID", 90)
.Columns.Add("Company", 130)
.Columns.Add("FolioNumber", 90, HorizontalAlignment.Right)
.Columns.Add("Total", 100, HorizontalAlignment.Right)
.Columns.Add("AmountPaid", 100, HorizontalAlignment.Right)
.Columns.Add("Balance", 100, HorizontalAlignment.Right)
FillListView(lvList, GetData(sSql))
49 | P a g e
EndWith
EndSub
EndClass
Vehicle info
PublicClassfrmVehicles
EndSub
EndSub
EndClass
50 | P a g e
3.2 Implement a client class with a main (), that calls operations in the Systems Manger class.
Imports System.Windows.Forms
PublicClassmdiMain
PrivateblnActiveAsBoolean
EndIf
Next
ReturnFalse
m_ChildFormNumber += 1
ChildForm.Text = "Window "& m_ChildFormNumber
ChildForm.Show()
EndSub
Privatem_ChildFormNumberAsInteger
52 | P a g e
'Guest.MdiParent = Me
Guest.StartPosition = FormStartPosition.CenterScreen
Guest.ShowDialog()
EndIf
EndSub
'Company.MdiParent = Me
Company.StartPosition = FormStartPosition.CenterScreen
Company.ShowDialog()
EndIf
EndSub
'BusinessSource.MdiParent = Me
BusinessSource.StartPosition = FormStartPosition.CenterScreen
BusinessSource.ShowDialog()
EndIf
EndSub
'ChargeType.MdiParent = Me
ChargeType.StartPosition = FormStartPosition.CenterScreen
ChargeType.ShowDialog()
EndIf
EndSub
'Countries.MdiParent = Me
Countries.StartPosition = FormStartPosition.CenterScreen
Countries.ShowDialog()
EndIf
EndSub
'IDType.MdiParent = Me
IDType.StartPosition = FormStartPosition.CenterScreen
IDType.ShowDialog()
EndIf
EndSub
'PaymentType.MdiParent = Me
PaymentType.StartPosition = FormStartPosition.CenterScreen
PaymentType.ShowDialog()
EndIf
54 | P a g e
EndSub
'RateType.MdiParent = Me
RateType.StartPosition = FormStartPosition.CenterScreen
RateType.ShowDialog()
EndIf
EndSub
'RoomStatus.MdiParent = Me
RoomStatus.StartPosition = FormStartPosition.CenterScreen
RoomStatus.ShowDialog()
EndIf
EndSub
RoomType.StartPosition = FormStartPosition.CenterScreen
RoomType.ShowDialog()
55 | P a g e
EndIf
EndSub
'Vehicles.MdiParent = Me
Vehicles.StartPosition = FormStartPosition.CenterScreen
Vehicles.ShowDialog()
EndIf
EndSub
'About.MdiParent = Me
About.StartPosition = FormStartPosition.CenterScreen
About.ShowDialog()
EndIf
EndSub
CheckInHistory.MdiParent = Me
CheckInHistory.StartPosition = FormStartPosition.CenterScreen
CheckInHistory.Show()
EndIf
EndSub
RoomWindow.MdiParent = Me
RoomWindow.StartPosition = FormStartPosition.CenterScreen
RoomWindow.Show()
EndIf
EndSub
ReservationList.MdiParent = Me
ReservationList.StartPosition = FormStartPosition.CenterScreen
ReservationList.Show()
EndIf
EndSub
InventoryView.MdiParent = Me
InventoryView.StartPosition = FormStartPosition.CenterScreen
InventoryView.Show()
EndIf
EndSub
RoomWindow.MdiParent = Me
RoomWindow.StartPosition = FormStartPosition.CenterScreen
RoomWindow.Show()
RoomWindow.WindowState = FormWindowState.Maximized
EndIf
EndSub
AccountReceivableList.MdiParent = Me
AccountReceivableList.StartPosition = FormStartPosition.CenterScreen
AccountReceivableList.Show()
AccountReceivableList.WindowState = FormWindowState.Maximized
EndIf
EndSub
frmReports.ShowDialog()
EndWith
EndSub
58 | P a g e
frmReports.ShowDialog()
EndWith
EndSub
Task 04
4.1 Test implemented object oriented solution by using test mechanisms (valid declarations,
debugging code, and comment code) and types (range testing, input testing, load testing, and
system compatibility).
Testing mechanisms
Testing is any activity aimed at evaluating an attribute or capability of a program or system and
determining that it meets its required results.The development process of Hotel Management System
involved various types of testing. Each test type addresses a specific testing requirement.
In order to deliver a good product I have used following testing techniques in the product.
This type of testing helps find out how well a system performs in a particular environment that
includes hardware, network, operating system and other software etc. Thus I have used this
basically for testing of the application or the product built with the computing environment. It
aided me in testing whether the application or the software product built is compatible with the
hardware, operating system, database or other system software or no
Unit testing
The primary goal of unit testing is to take the smallest piece of testable software in the
application, isolate it from the remainder of the code, and determine whether it
behaves exactly as you expect. Each unit is tested separately before integrating them
into modules to test the interfaces between modules. Unit testing has proven its value
in that a large percentage of defects are identified during its use.
60 | P a g e
I have used the most common approach to unit testing which requires drivers and stubs
to be written. The driver simulates a calling unit and the stub simulates a called unit. The
investment of developer time in this activity sometimes results in demoting unit testing
to a lower level of priority and that is almost always a mistake. It allows for automation
of the testing process, reduces difficulties of discovering errors contained in more
complex pieces of the application, and test coverage is often enhanced because
attention is given to each unit.
In this system I have defined primary artifacts (use cases). If the user agreed with those
artifacts, then it was going through the testing (unit testing) process. Coding & testing
are carried out in parallel. This is done to determine if individual modules/units meet
their specifications and if they are correctly coded & that it carries out the functions it is
supposed to carry out.As the developer of this system I have to carry out the unit
testing. It was very easy task for me because I was the person who is responsible for
programming & also testing. But this has some bad effects. If the programmer is the
tester of the system, some bugs could not be uncovered. If the tester is an individual
person, he can see some aspects which the programmer cannot see. But the difficult
thing is an independent tester should have learned the system entirely.
Integration testing
Integration testing is a logical extension of unit testing. In its simplest form, two
units that have already been tested are combined into a component and the
interface between them is tested. A component, in this sense, refers to an
integrated aggregate of more than one unit. In my scenario, many units are
combined into components, which are in turn aggregated into even larger parts
of the program. Eventually all the modules making up a process are tested
together.
Integration testing identifies problems that occur when units are combined. By
this I have known that any errors discovered when combining units are likely
related to the interface between units. This method reduces the number of
possibilities to a far simpler level of analysis.
Load testing
The primary goal of load testing is to define the maximum amount of work a system can
handle without significant performance degradation. I have used the method writing
and reading data to and from a hard disk continuously to check this on Hotel
Management system.
Installation testing
Finally this testing was carried out not to find software errors but to find
installation errors. When the system was installed, files were created, the
hardware is configured, and the program itself may have to interconnect with
an operating system.
When the hardware was configuring some configuration errors were appeared.
At that time I had to take assistance from the technician.
4.2 Error handling during software testing and give a feedback to improve the developed object oriented
solution. (Provide Suitable Screenshots)
Error handling refers to the anticipation, detection, and resolution of programming, application,
and communications errors. Specialized programs, called error handlers, are available for some
applications.In programming, a development error is one that can be prevented. Such an error
can occur in syntax or logic. Syntax errors, which are typographical mistakes or improper use of
special characters, are handled by rigorous proofreading. Logic errors, also called bugs, occur
when executed code does not produce the expected or desired result. Logic errors are best
handled by meticulous program debugging. This can be an ongoing process that involves, in
addition to the traditional debugging routine, beta testing prior to official release and customer
feedback after official release.
A run-time error takes place during the execution of a program, and usually happens because of
adverse system parameters or invalid input data. An example is the lack of sufficient memory to
run an application or a memory conflict with another program. On the Internet, run-time errors
can result from electrical noise, various forms of malware or an exceptionally heavy demand on
62 | P a g e
a server. Run-time errors can be resolved, or their impact minimized, by the use of error handler
programs, by vigilance on the part of network and server administrators, and by reasonable
security countermeasures on the part of Internet users.
Before proceeding I have identified each test case uniquely and explicitly associated with the
class to be tested
A list of testing steps should be developed for each test and should contain:
There are two methods of test case design I have used for error handling testing approach, they
are;
Black box
White box
Black box uses specifications to produce test cases (functional testing). White box
testing uses the internal logical structure of a module to produce test cases.
Equivalence Classes
Values
From Case1 ex: Admin, admin
Error handlingtest strategy with detail test plans and usability tests
Interface User
Login Administrator of the Hotelshould use this login and check whether
it is having enough restriction.
Menu Administrator of the Hotel should use this form and check whether
it is linking to the current interface or not.
Room Details Administrators of the Hotelshould use this Interface when dealing
with rooms’ details as well as adding new information so they have
to check the functionality of this interface.
Payments Details Administrator is using this interface and normally he/she should
use this part to add payment details.
Reports Normally users of the Hotel are using this Interface when dealing
with Hotel details, so they have to check the functionality of this
interface.
click login
or
The test data should include the minimum & maximum values of all data items (which
should be acceptable)
The system should only accept valid and specified data. All other data should be
reported and rejected, or totally ignored. Not only invalid inputs, but also illegal inputs
should be rejected.
This is a checking process which ensures that the software meets its requirements & that the
requirements meet the needs of the customer.
Verification refers to the set of activities that ensure that a product emerging from any phase of
the software engineering process (ex: a program) meets its specification.
Validation refers to a different set of activities that ensure that the phase product which has been
built is traceable to customer requirements. (It satisfies customer requirements)
Ex: acceptance testing (users check whether the system satisfies their needs)
Reviews are a special kind of verification technique. Reviews are organized manual approaches
to checking and analyzing software (ex: code, design specification, requirement specification,
etc.)
In a walkthrough, I used reselected test data to simulate execution of the analyzed program
(code, design, etc.)
In an inspection I have used a checklist of faults/errors to determine whether they occur in the
analyzed program (ex: code, design, etc.)
A scalable and secure solution to authenticate users has been given through this which aids in
error handling. This is a decision on what access privilege to grant to the users based on various
user and security attributes.
Deditaced help menu has been created with index and search options to naviagate
through system
69 | P a g e
Dedicated windows options have been created in order to aid in viewing according to the user
preference
4.4 Create technical documentation to include designs, delivery system, platform, environment,
file structures, coding, constraints, and maintenance requirements.
Hardware cost
Hardware Cost
Item
Software Cost
Windows 7
Visual Basic .Net 2010
SQL 2010 Server
Crystal Reports
The essential software can be taken with the hardware, in free of charge or can be obtained
from the specific web sites.
72 | P a g e
Task
Training rates
Training rates
Item Cost
References
Websites
1. http://objectplus.blogspot.com/2011/02/basic-characteristics-of-oop.html
2. http://codebetter.com/raymondlewallen/2005/07/19/4-major-principles-of-
object-oriented-programming/
3. http://www.differencebetween.net/technology/difference-between-class-and-
object/