Apply the following procedure for solving ALL the TMA problems
Distribution of Marks | |
Requirement | Mark |
Algorithm pseudocode | 20% |
Correct calculations formulas | 20% |
Testing using different data sets | 20% (10% for each data set) |
Valid report format | 5% |
Running application | 35% |
Problem # 1: (Gas Mileage Calculator) [25 marks]
Drivers are concerned with the mileage their automobiles get. One driver has kept track of several tankfuls of gasoline by recording the miles driven and gallons used for each tankful. Develop a C# application that will input the miles driven and gallons used for each tankful. The application should calculate and display the miles per gallon obtained for each tankful and display the total combined miles per gallon obtained for all tankfuls up to this point. Additionally, the application should categorize and display the consumption rate of gasoline as follows:
All averaging calculations should produce floating-point results. Display the results rounded to the nearest hundredth.
Sample I/O
Enter the gallons used (-1 to end): 20
Enter the miles driven: 200
The miles/gallon for this tank is: 10.00
This is equivalent to :
Enter the gallons used (-1 to end): 5
Enter the miles driven: 120
The miles/gallon for this tank is: 24.00
Enter the gallons used (-1 to end): 10.50
Enter the miles driven: 150
The miles/gallon for this tank is: 14.28
Enter the gallons used (-1 to end): -1
The overall average miles/gallon is: 13.23
The overall consumption rate is : High
Problem # 2: (Airline Reservations System) [35 marks]
A small airline has just purchased a computer for its new automated reservations system. You have been asked to develop the new system. You’re to write an application to assign seats on each flight of the airline’s only plane (the capacity of the plane is 10 seats of the same class). The flight ticket costs 500 $. Use a one-dimensional array of type Boolean to represent the seating chart of the plane. Initialize all the elements of the array to false to indicate that all the seats are empty. The user can choose his seat number (from 1 to 10) if it is available. As each seat is assigned, set the corresponding element of the array to true to indicate that the seat is no longer available. Your application should never assign a seat that has already been assigned. The baggage allowance is a single bag of 10 kg. Each extra kg is charged with 5 $. However, the weight of the bag should never exceed 20 kg. The reservation request of the customer should be rejected if his chosen seat number is not available and/or his baggage exceeds 20 kg and justified rejection message(s) should be alerted to the customer. Otherwise, a confirmation message that contains the customer’s seat number, extra weight fees, and total fees is alerted. The reservation process should continuously run for other customers until the user of the application explicitly ends it. At the end of the application, a summary of the number of reserved seats with total income should be alerted to the user.
Sample I/O
Enter seat number (-1 to end): 1
Enter the weight of the bag: 15
Reservation is confirmed for seat no. 1
Fees of extra weight: 25 $
Total fees: 525 $
Enter seat number (-1 to end): 2
Enter the weight of the bag: 10
Reservation is confirmed for seat no. 2
Fees of extra weight: 0 $
Total fees: 500 $
Enter seat number (-1 to end): 1
Reservation cancelled due to unavailable seat number
Enter seat number (-1 to end): 3
Enter the weight of the bag: 25
Reservation cancelled due to unallowed baggage weight
Enter seat number (-1 to end): -1
The flight has 2 reserved seats with total income 1025 $
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more
Recent Comments