Car maintenance booking provide the user the information for booking purposes. The information of the booking services has several information such as slot number and status that are stored in a file named “Services.txt”. In this case, the slot number will be used to locate the slot, while the status will be used to know the availability of the slot (i.e. ’1’ indicate the slot is occupied and ’0’ indicate the slot is available). Assuming there are 12 slot available, and have been indexed from 1 to 12. You are required to develop a C program that can access the data from “Services.txt”. file, and manage the slot information with the following requirements: Based on user selection, the program will perform one of the two following options: 1 – Search. The program should be able to display the status, based on the slot number entered by user. 2 – Booking. A function (in 3 (a)) is called to list out all available slot (which is indicated by status ’0’). Another function (in 3 (b)) will be called to process the booking procedures. Your program should be able to continue until the user has decided to exit the program. Before the program is terminated, all data will be written in " Services.txt" file.   b) Develop a function definition that bring one parameter as its argument (i.e. the array that store slot number and availability status). In this function, the user is required to key in a slot number. It is important to make sure the user can book ONLY on an available slot. Therefore, your program will not proceed if the index of the slot number entered by user is occupied (i.e. status is ’1’).

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Car maintenance booking provide the user the information for booking purposes. The
information of the booking services has several information such as slot number and status that
are stored in a file named “Services.txt”. In this case, the slot number will be used to locate the
slot, while the status will be used to know the availability of the slot (i.e. ’1’ indicate the slot
is occupied and ’0’ indicate the slot is available). Assuming there are 12 slot available, and
have been indexed from 1 to 12. You are required to develop a C program that can access the
data from “Services.txt”. file, and manage the slot information with the following requirements:
Based on user selection, the program will perform one of the two following options:
1 – Search. The program should be able to display the status, based on the slot number
entered by user.
2 – Booking. A function (in 3 (a)) is called to list out all available slot (which is
indicated by status ’0’). Another function (in 3 (b)) will be called to process the booking
procedures.
Your program should be able to continue until the user has decided to exit the program.
Before the program is terminated, all data will be written in " Services.txt" file.

 

b) Develop a function definition that bring one parameter as its argument (i.e. the array
that store slot number and availability status). In this function, the user is required to
key in a slot number. It is important to make sure the user can book ONLY on an
available slot. Therefore, your program will not proceed if the index of the slot number
entered by user is occupied (i.e. status is ’1’).

Please enter your selection 1 for SEARCH and 2 for BOOKING:1
Available slot - 1
Available slot -7
Available slot - 9
Available slot - 10
Available slot - 12
Enter 0 to continue: 0
Please enter your selection 1 for SEARCH and 2 for BOOKING:2
Enter the port that you would like to book:7
Port 7 is available
Enter 0 to continue: 0
Please enter your selection 1 for SEARCH and 2 for BOOKING:1
Available slot - 1
Available slot -9
Available slot - 10
Available slot - 12
Enter 0 to continue: 2
Figure 5
Services.txt - Notepad
File Edit Format View Help
21
31
41
51
6 1
71
81
90
10 0
11 1
120
Figure 6
Transcribed Image Text:Please enter your selection 1 for SEARCH and 2 for BOOKING:1 Available slot - 1 Available slot -7 Available slot - 9 Available slot - 10 Available slot - 12 Enter 0 to continue: 0 Please enter your selection 1 for SEARCH and 2 for BOOKING:2 Enter the port that you would like to book:7 Port 7 is available Enter 0 to continue: 0 Please enter your selection 1 for SEARCH and 2 for BOOKING:1 Available slot - 1 Available slot -9 Available slot - 10 Available slot - 12 Enter 0 to continue: 2 Figure 5 Services.txt - Notepad File Edit Format View Help 21 31 41 51 6 1 71 81 90 10 0 11 1 120 Figure 6
Expert Solution
steps

Step by step

Solved in 5 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY