0% found this document useful (0 votes)
2 views

programming report

The document outlines a series of programming assignments for students at the University of Science and Technology, focusing on travel expenses, theater seating, and customer accounts. Each assignment includes specific tasks, code requirements, and task allocations among team members, along with advantages and limitations of the implemented solutions. The document emphasizes the importance of input validation and structured programming for effective code maintenance and user interaction.

Uploaded by

vunguyenhongson3
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

programming report

The document outlines a series of programming assignments for students at the University of Science and Technology, focusing on travel expenses, theater seating, and customer accounts. Each assignment includes specific tasks, code requirements, and task allocations among team members, along with advantages and limitations of the implemented solutions. The document emphasizes the importance of input validation and structured programming for effective code maintenance and user interaction.

Uploaded by

vunguyenhongson3
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 22

THE UNIVERSITY OF SCIENCE AND TECHNOLOGY – THE

UNIVERSITY OF DA NANG
FACULTY OF ADVANCED SCIENCE AND TECHNOLOGY

COMPUTER PROGRAMMING REPORT

VŨ MẠNH KHA – ID: 123230070

PHẠM VĂN BẢO DUY – ID: 123230058

NGUYỄN ĐĂNG KHOA – ID: 123230072

VŨ NGUYÊN HỒNG SƠN – ID: 123230086

Lab 1 – Travel Expenses


1. Assignment:
- Write a program that calculates and displays the total travel expenses of a
businessperson on a trip. The program should have functions that ask for and return
the following:
● The total number of days spent on the trip
● The time of departure on the first day of the trip, and the time of arrival back
home on the last day of the trip • The amount of any round-trip airfare
● The amount of any car rentals • Miles driven, if a private vehicle was used.
Calculate the vehicle expense as $0.27 per mile driven
● Parking fees (The company allows up to $6 per day. Anything in excess of this
must be paid by the employee.)
● Taxi fees, if a taxi was used anytime during the trip (The company allows up
to $10 per day, for each day a taxi was used. Anything in excess of this must
be paid by the employee.)
● Conference or seminar registration fees • Hotel expenses (The company
allows up to $90 per night for lodging. Anything in excess of this must be paid
by the employee.)
● The amount of each meal eaten. On the first day of the trip, breakfast is
allowed as an expense if the time of departure is before 7 a.m. Lunch is
allowed if the time of departure is before 12 noon. Dinner is allowed on the
first day if the time of departure is before 6 p.m. On the last day of the trip,
breakfast is allowed if the time of arrival is after 8 a.m. Lunch is allowed if the
time of arrival is after 1 p.m. Dinner is allowed on the last day if the time of
arrival is after 7 p.m. The program should only ask for the amounts of
allowable meals. (The company allows up to $9 for breakfast, $12 for lunch,
and $16 for dinner. Anything in excess of this must be paid by the employee.)
- The program should calculate and display the total expenses incurred by the
businessperson, the total allowable expenses for the trip, the excess that must be
reimbursed by the businessperson, if any, and the amount saved by the
businessperson if the expenses were under the total allowed.
Input Validation: Do not accept negative numbers for any dollar amount or for
miles driven in a private vehicle. Do not accept numbers less than 1 for the number
of days. Only accept valid times for the time of departure and the time of arrival.
2. Task Allocation:

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:

● Functions are clearly divided, ensuring easy maintenance and testing.


● Most of the data input functions have been completed.
● Calculations for personal vehicle costs, taxi fees, conference registration, and
hotel expenses have been implemented, enabling the system to compute basic
trip costs.

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

b) Vũ Mạnh Kha: Write the main function.

c) Nguyễn Đăng Khoa: Write and call the functions.

d) Phạm Văn Bảo Duy: Perform the calculations.

3. Result:
a) Code:

8
9
10
b) Code Output:

11
12
4. Conclusion on the results:
a) Advantages:

● The menu-driven approach is intuitive and simple.


● Clear prompts guide the user during ticket purchases.
● Functions are logically separated, ensuring ease of debugging and
enhancement.
● Input checks prevent invalid entries and ensure correct data processing.
● The external file allows flexible price adjustments.

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.

c) Nguyễn Đăng Khoa: Write and call the functions.

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:

● Functions are clearly divided, ensuring easy maintenance and testing.


● Most of the data input functions have been completed.
● The main menu provides a clear and intuitive interface for navigating between
functions.

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

You might also like