Académique Documents
Professionnel Documents
Culture Documents
1|Page
ICP assignment
Table of Contents
Introduction ............................................................................................................................... 3
Assumption of system ............................................................................................................... 4
Pseudocode ................................................................................................................................ 5
Flowchart ................................................................................................................................. 15
Source code ............................................................................................................................. 18
Add feature .............................................................................................................................. 30
Sample output .......................................................................................................................... 35
Conclusion ............................................................................................................................... 42
References ............................................................................................................................... 43
2|Page
ICP assignment
Introduction
Ballroom Reservation System is designed and implemented in order to improve and
speed up the process of Ballroom reservation for the customer. The user is required to
register to use the system. After the registration user able to fill up the reservation
detail. Besides that, the user also can change their reservation time, personal detail
and also can cancel their booking. Lastly, the user can view their own reservation
detail for the system.
3|Page
ICP assignment
Assumption of system
I assumption the objective of this designed Ballroom Reservation System is to provide
benefits to the user as well to reserve ballroom easily and to store all the information
and data easily.
1. Assume the user to allow register a user account for the Ballroom reservation
system. The user needs to register User ID and User Password before they can
use the Ballroom Reservation System.The user allows to login to the system
to book for the Ballroom.
2. Assume the user is able to view the reservation done by their own and They
can review the detail of the ballroom they had booked.
3. Assume the user is able to change their own reservation time and personal
detail. The user is able to modify their reservation detail after booking the
ballroom.
4. Assume the user is able to cancellation their own reservation. The user is
allowed to cancel their reservation of the ballroom.
4|Page
ICP assignment
Pseudocode
Main Menu
User
BEGIN
Read CHOICE
Switch(CHOICE)
Case 1:
Go to Login
Break
Case 2:
Go to Register
Break
Case 3:
Go to Exit
Break
Default:
Go to User
Break
5|Page
ICP assignment
ENDCASE
END
Register
BEGIN
Read UserID
IF (USERID = TRUE)
Print “Password”
Read Password
Go to User
Break
ELSE
Go to User
Break
ENDIF
END
Login
BEGIN
Read UserID
6|Page
ICP assignment
IF (UserID = TRUE)
Print “Password”
Read Password
Go to Menu
Break
ELSE
Go to User
ENDIF
END
Menu
BEGIN
Read choice
Switch (choice)
Case 1:
7|Page
ICP assignment
Go to Reservation
Break
Case 2:
Go to Cancelation
Break
Case 3:
Go to Change_time
Break
Case 4:
Go to Display_reservation
Break
Case 5:
Exit
Break
Default:
Go to Menu
Break
ENDCASE
END
Reservation
BEGIN
8|Page
ICP assignment
Print “Enter your ID”
Read ID
IF (ID = TRUE)
Read choice
Switch (choice)
Case 1
Read Name
Read IC
Read Phone
Read Date
Read Time
Go to Menu
Break
9|Page
ICP assignment
Case 2
Go to Menu
Break
Default
Break
Else
Go to Menu
ENDCASE
ENDIF
END
Change_detail
BEGIN
Read ID
IF (ID= TRUE)
Read choice
10 | P a g e
ICP assignment
Switch(choice)
Case 1:
Read Name
Read IC
Read Phone
Read Time
Read Date
Go to Menu
Break
Case 2:
Got to Menu
Break
Default:
Go to Menu
11 | P a g e
ICP assignment
Break
Else:
Go to Menu
ENDCASE
ENDIF
END
Display_reservation
BEGIN
IF (FILE=NULL)
Go to Menu
Break
ELSE
Print UserDetail
Go to Menu
Break
ENDIF
END
Cancelation
12 | P a g e
ICP assignment
BEGIN
Print “Cancelation”
Read ID
Read Choice
Switch (choice)
Case 1:
IF (FILE= True)
Delete file
Print “Removed”
ENDIF
Case 2:
Go to Menu
Break
Default:
Go to Menu
13 | P a g e
ICP assignment
Break
ENDCASE
END
Exit
BEGIN
END
14 | P a g e
ICP assignment
Flowchart
Start
Main
Print
1.Login,
2.Registe
r 3.Exit
Print
Enter your
choice
Input
choice
Print
Invalid False
choice Switch
please try choice
again 1-
3” True
Input ID Input ID
Print Invalid
True Registration
False
If ID == True
Print
If ID == True
Invalid
ID True
False
Input Input
Password Password
True
Read ID
Print and
Wrong Password
If Password == True
Password
False
User.txt
Print
Login
Successful
ly Print
Register
Successfully
A
15 | P a g e
ICP assignment
A
Print Reservatio
n
2.Cancelation
3.Change
reservation time
4.Display
reservation
5.Exit
Print
Enter your
choice
Input
choice
Print
Switch
Invalid
choice
option
False
True
Change
Display
Reservation Cancelation reservation Exit
reservation
detail
Print Print
Enter your Enter your c
B
ID ID
Print False
Invalid ID== True ID = = True Print
ID False Invalid
True
True ID
Print
Print
Confirm
Confirm
Reservation
Change
reservatio
n detail
Input
choice
Input
choice
Print
Switch Print
Invalid
choice Cancel False Print
choice Switch
Change Invalid
choice
True Yes reservatio choice
n detail No True
No Print
Print Yes
Enter
cancel
Your
reservatio
reservatio
n Print Enter
n Detail
Your New
reservation
Detail
User.txt
User.txt
Print
Reservation
successfully
Print
Modifies
successfully
16 | P a g e
ICP assignment
Print Reservation
2.Cancelation
3.Change
reservation time
4.Display
reservation
5.Exit
Print
Enter your
choice
Input
choice
Print
Switch
Invalid
choice
option False
True
Change
Display
Reservation Cancelation reservation Exit
reservation
detail
Print No
Enter your If user have Print Invalid
ID booking file
False yes
Print
Invalid ID
ID = = True
Read all user
detail
True
Print
Confirm
cancel your
booking?
Display user
detail
Input
choice
False
Print
Switch
Invalid
choice choice
True
NO
Yes
Print Cancel
successfully
17 | P a g e
ICP assignment
Source code
18 | P a g e
ICP assignment
Void Main() function use to initialize the execution of program. Void Menu is to
display the main function for Ballroom Reservation System
19 | P a g e
ICP assignment
Void User() function is the for the user only when they can choose 3 option for login,
register and exit function.
20 | P a g e
ICP assignment
User is required to register first before they can use the Ballroom Reservation System.
21 | P a g e
ICP assignment
Void Login() function is give user to login the Ballroom Reservation System.
22 | P a g e
ICP assignment
23 | P a g e
ICP assignment
24 | P a g e
ICP assignment
25 | P a g e
ICP assignment
Void Change_detail() function is allowed user to change they reservation time, date
and their personal detail.
26 | P a g e
ICP assignment
27 | P a g e
ICP assignment
28 | P a g e
ICP assignment
Void Exit() function is give user exit the Ballroom Reservation system.
29 | P a g e
ICP assignment
Add feature
Figure 18 Header
The #include <stdio.h> header defines three variable types, several macros, and
various functions for performing input and output. (tutorialspoint.com, 2017)
A function declaration tells the compiler about a function's name, return type, and
parameters. A function definition provides the actual body of the function.
(tutorialspoint.com, 2017)
Global variables are defined outside a function, usually on top of the program. Global
variables hold their values throughout the lifetime of the program and can be accessed
inside any of the functions defined for the program. A global variable can be accessed
by any function. It is available for use throughout entire program after declaration.
(tutorialspoint.com, 2017)
30 | P a g e
ICP assignment
Main() function is the entry point of any C program. It is the point at which
execution of program is started. When a C program is executed, the execution
control goes directly to the main() function . Every C program have a main()
function. (sitesbay.com, 2017)
Function declared by the system of visual studio itself. system(“cls”) is used to clear
the screen to delete the output before this code was execute and System(“pause”) is
used to pause the program.
Variables that are declared inside a function or block are called local variables. They
can be used only by statements that are inside that function or block of code. Local
variables are not known to functions outside their own. The following example shows
how local variables are used. (tutorialspoint.com, 2017)
31 | P a g e
ICP assignment
Printf is means to print the following sentences and scanf is means to scan the
following input for the sentences.
A switch statement allows a variable to be tested for equality against a list of values.
Each value is called a case, and the variable being switched on is checked for each
switch case. (tutorialspoint.com, 2017)
32 | P a g e
ICP assignment
If statement can be followed by an optional else statement, which executes when the
Boolean expression is false. If the Boolean expression evaluates to true, then the if
block will be executed, otherwise, the else block will be executed. (tutorialspoint.com,
2017)
Strcpy is to copy a string to another string and strcat is to concatenates two strings.
33 | P a g e
ICP assignment
This function of fprintf is puts or print the data or statement into the file that have being
opened before.
34 | P a g e
ICP assignment
Sample output
35 | P a g e
ICP assignment
36 | P a g e
ICP assignment
37 | P a g e
ICP assignment
38 | P a g e
ICP assignment
39 | P a g e
ICP assignment
40 | P a g e
ICP assignment
41 | P a g e
ICP assignment
Conclusion
This assignment is to create a Ballroom Reservation System for the user to make the
process of ballroom reservation become more convenient. In orders to access the
Ballroom Reservation System, the user is needed to register a new account through
the system, so user can login for the system and access the function in the system. The
user also able to reservation, change reservation detail, view reservation, cancels their
own reservation. In conclusion, the implementation of this system will bring a lot of
benefits to the user. They can save a lot of time and this system can prevent some
mistake of humanly such as lose the reservation detail.
42 | P a g e
ICP assignment
References
https://www.tutorialspoint.com/c_standard_library/stdio_h.htm. (n.d.).
43 | P a g e