programming report
programming report
UNIVERSITY OF DA NANG
FACULTY OF ADVANCED SCIENCE AND TECHNOLOGY
a) Vũ Nguyên Hồng Sơn: Develop the main function to call other functions.
b) Vũ Mạnh Kha: Develop the function to calculate costs and the function to check
cost allowable.
c) Nguyễn Đăng Khoa: Write the code for input and output of data.
2
3. Result:
a) Code:
3
4
b) Code Output:
5
4. Conclusion on the results:
a) Advantages:
b) Missing Parts:
● The program lacks a section to check and notify users about expenses
exceeding the company's allowed limit.
● Meal cost calculations based on departure and return times are incomplete.
● The final result display, including the additional amount to be paid, has not
been finished.
6
Lab 2 – Theater Seating
1. Assignment:
- Write a program that can be used by a small theater to sell tickets for performances.
The theater’s auditorium has 15 rows of seats, with 30 seats in each row. The
program should display a screen that shows which seats are available and which are
taken. For example, the following screen shows a chart depicting each seat in the
theater. Seats that are taken are represented by an * symbol, and seats that are
available are represented by a # symbol:
Seats 123456789012345678901234567890
Row 1 ***###***###*########*****####
Row 2 ####*************####*******##
Row 3 **###**********########****###
Row 4 **######**************##******
Row 5 ********#####*********########
Row 6 ##############************####
Row 7 #######************###########
Row 8 ************##****############
Row 9 #########*****############****
Row 10 #####*************############
Row 11 #**********#################**
Row 12 #############********########*
Row 13 ###***********########**######
Row 14 ##############################
Row 15 ##############################
- Here is a list of tasks this program must perform:
● When the program begins, it should ask the user to enter the seat prices for
each row. The prices can be stored in a separate array. (Alternatively, the
prices may be read from a file.)
● Once the prices are entered, the program should display a seating chart similar
to the one shown above. The user may enter the row and seat numbers for
7
tickets being sold. Every time a ticket or group of tickets is purchased, the
program should display the total ticket prices and update the seating chart.
● The program should keep a total of all ticket sales. The user should be given
an option of viewing this amount.
● The program should also give the user an option to see a list of how many
seats have been sold, how many seats are available in each row, and how many
seats are available in the entire auditorium.
Input Validation: When tickets are being sold, do not accept row or seat numbers
that do not exist. When someone requests a particular seat, the program should make
sure that seat is available before it is sold.
2. Task Allocation:
a) Vũ Nguyên Hồng Sơn: Write the function().
3. Result:
a) Code:
8
9
10
b) Code Output:
11
12
4. Conclusion on the results:
a) Advantages:
b) Limitations:
● The program does not handle the absence of the price.txt file gracefully.
● No handling of non-numeric inputs, which could lead to program crashes.
13
Lab 3 – Customer Accounts
1. Assignment:
- Write a program that uses a structure to store the following data about a customer
account:
Name
Address
City, State, and ZIP
Telephone Number
Account Balance
Date of Last Payment
- The structure should be used to store customer account records in a file. The
program should have a menu that lets the user perform the following operations:
● Enter new records into the file.
● Search for a particular customer’s record and display it.
● Search for a particular customer’s record and delete it.
● Search for a particular customer’s record and change it.
● Display the contents of the entire file.
Input Validation: When the data for a new account is entered, be sure the user
enters data for all the fields. No negative account balances should be entered.
2. Task Allocation:
a) Vũ Nguyên Hồng Sơn: Write the function for inputting records.
b) Vũ Mạnh Kha: Write the functions for search, display, and update.
d) Phạm Văn Bảo Duy: Write the main function and the functions for delete and
display all.
3. Result:
a) Code:
14
15
16
17
18
b) Code Output:
19
20
21
4. Conclusion on the results:
a) Advantages:
b) Missing Parts:
● The DisplayAll function is not yet implemented, limiting the ability to view all
records at once.
● The program requires manual input for file names and paths, which could lead
to errors.
22