Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 . Files will be stored inside a directory called data within the same directory as your script. 2 . Each file will be named

1. Files will be stored inside a directory called data within the same directory as your script.
2. Each file will be named based on the combination of a department code and a course number,
which consists of two or three letters followed by an integer with exactly four digits, followed by
the extension .crs.
3. A course file consists of exactly these lines:
dept_code (two or three letter abbreviation) dept_name (string with probable whitespace)
course_name (string with probable whitespace)
course_sched (string consisting precisely of either MWF or TH) course_start (string
with no whitespace) course_end (string with no whitespace) course_hours (credit hours,
unsigned integer) course_size (enrolled students, unsigned integer)
* Department names may contain whitespace. You should account for names with multiple tokens
(e.g.,ESL English as a Second Language= dept_code =ESL, and dept_name =English
as a Second Language)
4. Example file named esl3053.crs
ESL English as a Second Language
Literacy in a Second Language
MWF 8/20/2412/13/24352
Script Execution
When the script is run, the following should occur. All script output should appear exactly as it
appears below.
1. Upon running your script, the user should be presented with the following menu:
Enter one of the following actions or press CTRL-D to exit.
C - create a new course record
R - read an existing course record
U - update an existing course record
D - delete an existing course record
E - update enrolled student count of existing course
T - show total course count
2. The user then enters a one-character action (upper or lowercase), leading to one of the following.
C: a course is created
(a) From the terminal, read the following one at a time:
i. Department code (two-to-three character string)
ii. Department name (string possibly containing whitespace)1. Files will be stored inside a directory called data within the same directory as your script.
2. Each file will be named based on the combination of a department code and a course number,
which consists of two or three letters followed by an integer with exactly four digits, followed by
the extension .crs.
3. A course file consists of exactly these lines:
dept_code (two or three letter abbreviation) dept_name (string with probable whitespace)
course_name (string with probable whitespace)
course_sched (string consisting precisely of either MWF or TH) course_start (string
with no whitespace) course_end (string with no whitespace) course_hours (credit hours,
unsigned integer) course_size (enrolled students, unsigned integer)
* Department names may contain whitespace. You should account for names with multiple tokens
(e.g.,ESL English as a Second Language= dept_code =ESL, and dept_name =English
as a Second Language)
4. Example file named esl3053.crs
ESL English as a Second Language
Literacy in a Second Language
MWF 8/20/2412/13/24352
Script Execution
When the script is run, the following should occur. All script output should appear exactly as it
appears below.
1. Upon running your script, the user should be presented with the following menu:
Enter one of the following actions or press CTRL-D to exit.
C - create a new course record
R - read an existing course record
U - update an existing course record
D - delete an existing course record
E - update enrolled student count of existing course
T - show total course count
2. The user then enters a one-character action (upper or lowercase), leading to one of the following.
C: a course is created
(a) From the terminal, read the following one at a time:
i. Department code (two-to-three character string)
ii. Department name (string possibly containing whitespace)
iii. Course number (integer)
iv. Course name (string possibly containing whitespace)
v. Course schedule (string in {MWF,TH})
vi. Course start date (string with slashes)
vii. Course end date (string with slashes)
viii. Course credit hours (unsigned integer)
ix. Initial course enrollment (unsigned integer)
(b) Using the values entered by the user, create a new file in the data folder based on the
instructions above.
(c) Update data/queries.log by adding the following line:
[date] CREATED: dept_code course_num course_name
where date is the output from the date command and dept_code, course_num, and
course_name are the corresponding values.
(d) If the course already exists, print the following error and continue with the script. The
script should accept all seven inputs before checking if the record exists.
ERROR: course already exists
R: read an existing courses information
(a) Prompt the user for a course department and course number: (e.g.,cs 3424)
Enter a department code and course number:
(b) Search for the specified course using the provided department and number (e.g.,cs
3424).
(c) Print the course information in the following format:
Course department: dept_code dept_name
Course number: course_num
Course name: course_name:
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions