Problem1: FILE HANDLING PROGRAM. Marah Land Theme Park wants you to create a ticketing system for their establishment. They also want to monitor the visitors coming to the park. You are tasked to create a program that will read the visitor information in an input file called “input.txt”. The input file contains the following information: Harith Al Rashdy Muscat 5 2 3 The descriptions of the file content are displayed below: Line Number Description 1 Name of the Guest 2 Place of Visitor 3 Number of visitors 4 Number of Adults 5 Number of Children The ticket fee for adult 6 OMR/person and Child 3.5 OMR/Child The service charge rate has a fixed value of 0.600 Baisa for both adult and child You are tasked to do the following: 1. Create a function that will read the input file and will display all the file contents in your screen. 2. Create a function that will compute the total fee. The total fee is computed by multiplying the number of adult visitors and their ticket fee + multiplying the number of child visitors and their ticket fee. 3. Create a function that will compute the service charge. The service charge is computed as total fee multiplied to service charge rate. 4. Create a function that will compute for the discount. The discount is given based on the visitor’s place. If the visitors are from “Muscat”, discount is computed as 2% of the total fee, otherwise it is computed as 3.5% of the total fee. 5. Create a function that will compute for the total bill. The total bill is computed as total fee plus service charge minus the discount. 6. Call all your functions in the main program and write the computed values: total fee, service charge, discount, and total bill into the file “ouput.txt”.
Problem1: FILE HANDLING PROGRAM.
Marah Land Theme Park wants you to create a ticketing system for their establishment. They also want to monitor the visitors coming
to the park. You are tasked to create a program that will read the visitor information in an input file called “input.txt”. The input file
contains the following information:
Harith Al Rashdy
Muscat
5
2
3
The descriptions of the file content are displayed below:
Line Number Description
1 Name of the Guest
2 Place of Visitor
3 Number of visitors
4 Number of Adults
5 Number of Children
The ticket fee for adult 6 OMR/person and Child 3.5 OMR/Child
The service charge rate has a fixed value of 0.600 Baisa for both adult and child
You are tasked to do the following:
1. Create a function that will read the input file and will display all the file contents in your screen.
2. Create a function that will compute the total fee. The total fee is computed by multiplying the number of adult visitors and their
ticket fee + multiplying the number of child visitors and their ticket fee.
3. Create a function that will compute the service charge. The service charge is computed as total fee multiplied to service charge
rate.
4. Create a function that will compute for the discount. The discount is given based on the visitor’s place. If the visitors are from
“Muscat”, discount is computed as 2% of the total fee, otherwise it is computed as 3.5% of the total fee.
5. Create a function that will compute for the total bill. The total bill is computed as total fee plus service charge minus the discount.
6. Call all your functions in the main program and write the computed values: total fee, service charge, discount, and total bill into
the file “ouput.txt”.
Step by step
Solved in 2 steps with 1 images