Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You have been provided a customer reservation transactions file (/usr/local/courses/clark/cs3423/2017Fa/Proj3/reservation.txt). It contains three types of records: CUST a customer definition record containing gender, birthdate, email

You have been provided a customer reservation transactions file (/usr/local/courses/clark/cs3423/2017Fa/Proj3/reservation.txt). It contains three types of records:

CUST a customer definition record containing gender, birthdate, email address, and full name.

RESERVE a reservation request containing flight number, number of seats requested, and cost per seat. These reservations are for the customer defined by the most recent CUST transaction.

ENDCUST a sentinel marking the end of the transactions for one customer.

Example data for one customer:

CUST M 1957/02/02 pcorn@abc.net Pop Corn

RESERVE H222.15005 10 170.00

RESERVE H333.15010 5 200.00

ENDCUST

For part B, you must produce the following output:

1. Print a table heading showing "Name", "Flight", "Seats", and "Total Cost"

2. For each customer's reservations, show last name(max of 12 characters), flight number (max of 10 characters, number of seats requested, and total cost (number of seats requested * cost per seat)

3. After processing the customer's reservations, show "Total" (in the Seats column) and his/her total cost under the Total Cost column.

4. After processing all the data:

Print a table heading that shows "Flight", "Total Seats"

For each flight, show flight number and the total of all seats requested across all customers.

Sample output:

Name Flight Seats Total Cost

Moss H100.15005 2 220.00

Moss H222.15005 2 340.00

Moss H200.15010 2 150.00

Moss H333.15010 2 400.00

Total 1110.00

Corn H222.15005 10 1700.00

Corn H333.15010 5 1000.00

Total 2700.00

Loafer H444.15001 1 125.00

Loafer H333.15010 1 200.00

Total 325.00

Sandler H100.15005 3 330.00

Sandler H222.15005 3 510.00

Sandler H333.15010 3 600.00

Total 1440.00

Toast H333.15010 2 400.00

Toast H444.15015 2 250.00

Total 650.00

Flight Total Seats

H333.15010 13

H444.15001 1

H200.15010 2

H444.15015 2

H222.15005 15

H100.15005 5

What to turn in

Via Blackboard turn in one zip fle named LastnameFirstName.zip containing:

p3a.bash - bash file that runs your awk scripts and sort. It should only contain two lines (the shebang line and the one line that invokes the awk/sort). The output should be placed in p3a.out.

p3axxxxx.awk - multiple awk files to help arrange the names to make sorting easy (and then change it to the final result)

p3b.bash - bash file that runs your awk script which produces output in p3b.out

p3b.awk - awk file for part B

customer reservation transactions file:

CUST M 1986/01/01 petem@xyz.net Pete Moss RESERVE H100.15005 2 110.00 RESERVE H222.15005 2 170.00 RESERVE H200.15010 2 75.00 RESERVE H333.15010 2 200.00 ENDCUST CUST M 1957/02/02 pcorn@abc.net Pop Corn RESERVE H222.15005 10 170.00 RESERVE H333.15010 5 200.00 ENDCUST CUST F 1958/03/03 pennyl@xyz.net Penny Loafer RESERVE H444.15001 1 125.00 RESERVE H333.15010 1 200.00 ENDCUST CUST M 1979/04/04 hgilmore@xyz.net Adam Sandler RESERVE H100.15005 3 110.00 RESERVE H222.15005 3 170.00 RESERVE H333.15010 3 200.00 ENDCUST CUST F 1989/05/05 butter@xyz.net Melba Toast RESERVE H333.15010 2 200.00 RESERVE H444.15015 2 125.00

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

More Books

Students also viewed these Databases questions