Vous êtes sur la page 1sur 43

ICP assignment

Course Code: CT018-3-1-ICP

Lecturer Name: SUPRIYA SINGH

Intake Code: UC1F1605IT

Submission Date: 23/2/2017

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

Print “Welcome to Ballroom Reservation System”

Print “1. Login”

Print “2. Register”

Print “3. Exit”

Print “Enter your choice”

Read CHOICE

Switch(CHOICE)

Case 1:

Go to Login

Break

Case 2:

Go to Register

Break

Case 3:

Go to Exit

Break

Default:

Print “Invaild Choice pls try again”

Go to User

Break

5|Page
ICP assignment
ENDCASE

END

Register

BEGIN

Print “Registration for user”

Read UserID

IF (USERID = TRUE)

Print “Password”

Read Password

Upload and store into FILE

Print “Registration Successfully”

Go to User

Break

ELSE

Print “Invalid Registration”

Go to User

Break

ENDIF

END

Login

BEGIN

Print “User Login”

Read UserID

6|Page
ICP assignment
IF (UserID = TRUE)

Print “Password”

Read Password

Upload and Store into FILE

Print “Login Successfully”

Go to Menu

Break

ELSE

Print “Invalid Login”

Go to User

ENDIF

END

Menu

BEGIN

Print “1. Reservation”

Print “2. Cancelation”

Print “3. Change Reservation Time”

Print “4. Display reservation”

Print “5. Exit”

Print “Enter your choice”

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:

Print “Invaild option pls try again”

Go to Menu

Break

ENDCASE

END

Reservation

BEGIN

Print “User Reservation”

8|Page
ICP assignment
Print “Enter your ID”

Read ID

IF (ID = TRUE)

Print “User reservation”

Print “Confirm Reservation”

Print “1. Yes”

Print “2. No”

Read choice

Switch (choice)

Case 1

Print “Enter your Name”

Read Name

Print “Enter your IC”

Read IC

Print “Enter your phone number”

Read Phone

Print “Enter your Date”

Read Date

Print “Enter your Time”

Read Time

Upload and Store into FILE

Print “Reserve Successfully”

Go to Menu

Break

9|Page
ICP assignment
Case 2

Print “Reservation Cancel”

Go to Menu

Break

Default

Print “Invalid Choice”

Break

Else

Print “Invalid ID”

Go to Menu

ENDCASE

ENDIF

END

Change_detail

BEGIN

Print “Change reservation detail”

Print “Enter your ID:”

Read ID

IF (ID= TRUE)

Print “Confirm change reservation detail?”

Print “1. Yes”

Print “2. No”

Read choice

10 | P a g e
ICP assignment
Switch(choice)

Case 1:

Print “Enter your name”

Read Name

Print “Enter your IC”

Read IC

Print “Enter your phone number”

Read Phone

Print “Enter New time”

Read Time

Print “Enter New date”

Read Date

Upload and Store into FILE

Print “Modified successfully”

Go to Menu

Break

Case 2:

Print “Cancel change reservation detail”

Got to Menu

Break

Default:

Print “Invalid choice”

Go to Menu

11 | P a g e
ICP assignment
Break

Else:

Print “Invalid ID”

Go to Menu

ENDCASE

ENDIF

END

Display_reservation

BEGIN

Print “Display reservation”

IF (FILE=NULL)

Print “Invalid File”

Go to Menu

Break

ELSE

Print UserDetail

Go to Menu

Break

ENDIF

END

Cancelation

12 | P a g e
ICP assignment
BEGIN

Print “Cancelation”

Print “Enter your ID”

Read ID

Print “Confirm cancel your booking?”

Print “1. Yes”

Print “2. No”

Read Choice

Switch (choice)

Case 1:

IF (FILE= True)

Delete file

Print “Removed”

Print “Delete Successfully”

Else (FILE = False)

Print “Invalid ID”

ENDIF

Case 2:

Print “No cancellation”

Go to Menu

Break

Default:

Print “Invalid Choice”

Go to Menu

13 | P a g e
ICP assignment
Break

ENDCASE

END

Exit

BEGIN

Print “Goodbye! See you again!”

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

1.Login 2.Register 3.Exit

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 No Delete user


cancelation detail

Print Cancel
successfully

17 | P a g e
ICP assignment
Source code

Figure 1: Source code for initializing variable and functions

Declaration of all the struct function and global variable.

Figure 2: Main() and Menu() Function

18 | P a g e
ICP assignment

Figure 3: Menu() Function

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

Figure 4 User() function

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

Figure 5:Register() Function

User is required to register first before they can use the Ballroom Reservation System.

21 | P a g e
ICP assignment

Figure 6&7 Login() function

Void Login() function is give user to login the Ballroom Reservation System.

22 | P a g e
ICP assignment

Figure8: Reservation() function

23 | P a g e
ICP assignment

Figure 9: Reservation() function

Figure 10: Reservation() function

Void Reservation() function is give user to reservation the ballroom.

24 | P a g e
ICP assignment

Figure 11: Change_detail() function

25 | P a g e
ICP assignment

Figure 12: Change_detail() function

Figure13: Change_detail() function

Void Change_detail() function is allowed user to change they reservation time, date
and their personal detail.

26 | P a g e
ICP assignment

Figure 14: Display_reservation function

Void Display_reservation() function is give user to view their reservation detail.

27 | P a g e
ICP assignment

Figure 15: Cancelation() function

28 | P a g e
ICP assignment

Figure 16: Cancelation () function

Void Cancelation() function is give user allowed to cancel they reservation.

Figure 17: Exit() function

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)

Figure 19: Function Declaration

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)

Figure 20: Global Variable

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

Figure 21: main function

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)

Figure 22: System function

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.

Figure 23: Local Variable

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

Figure 24: input and output

Printf is means to print the following sentences and scanf is means to scan the
following input for the sentences.

Figure 25: Switch

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

Figure 26: While Loop

A while loop in C programming repeatedly executes a target statement as long as a


given condition is true. (tutorialspoint.com, 2017)

Figure 27: If statement

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)

Figure 28: String function

Strcpy is to copy a string to another string and strcat is to concatenates two strings.

Figure 29: File open function

File open function is use to open some specific file.

33 | P a g e
ICP assignment

Figure 30: File function

This function of fprintf is puts or print the data or statement into the file that have being
opened before.

Figure 31: file function

Fclose function is use to close the file.

Figure 32: Exit function

Exit Function is use to exit the program.

34 | P a g e
ICP assignment
Sample output

Figure 33: Main Menu

Figure 34: Register function

35 | P a g e
ICP assignment

Figure 35: Login function

Figure 36: Menu function

36 | P a g e
ICP assignment

Figure 37: Reservation function

Figure 38: Reservation function

37 | P a g e
ICP assignment

Figure 39: Reservation function

Figure 41: Change reservation time function

38 | P a g e
ICP assignment

Figure 42: Change reservation detail function

Figure 43: Change reservation time function

39 | P a g e
ICP assignment

Figure 44: Display reservation function

Figure 45: Cancelation function

40 | P a g e
ICP assignment

Figure 46: cancelation function

Figure 47: Exit function

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.).

If statement. (2017, February 21). Retrieved from tutorialspoint:


https://www.tutorialspoint.com/cprogramming/if_statement_in_c.htm

sitesbay.com. (2017). Retrieved from http://www.sitesbay.com/cpp/cpp-main()-


function

tutorialspoint.com. (2017). Retrieved from


https://www.tutorialspoint.com/cprogramming/c_while_loop.htm

tutorialspoint.com. (2017). Retrieved from


https://www.tutorialspoint.com/cprogramming/if_statement_in_c.htm

tutorialspoint.com. (2017). Retrieved from


https://www.tutorialspoint.com/cprogramming/switch_statement_in_c.htm

tutorialspoint.com. (2017). Retrieved from


https://www.tutorialspoint.com/cprogramming/c_scope_rules.htm

tutorialspoint.com. (2017). Retrieved from www.tutorialspoint.com

tutorialspoint.com. (2017). Retrieved from


https://www.tutorialspoint.com/cprogramming/c_functions.htm

tutorialspoint.com. (2017). Retrieved from


https://www.tutorialspoint.com/cprogramming/c_header_files.htm

43 | P a g e

Vous aimerez peut-être aussi