Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

CISC-1600 : Computer Science I : Lab #5

This lab is our introduc0on to condi0onal statements.

We will write a small program for Fordham Airlines to allow the customer to purchase ights, calcula0ng how much the customer owes, taking payment, and calcula0ng change.

The airline sells 0ckets for travel during two 0me periods: day0me (depar0ng 5am-7pm) and nighFme (depar0ng 7pm-5am).

The airline sells 0ckets for three des0na0ons: Chicago, Miami, and Portland.

The airline sells 0ckets for two types of days: weekday and weekend (you could use 'D' for weekday and 'E' for weekend).

Pricing informa<on:

For Miami travel, flight prices are as follows:

For weekday travel: $150 during the day0me, $100 during the nighFme

For weekend travel: $180 during the day0me, $120 during the nighFme

Chicago flights cost half the price of Miami ights, and Portland ights cost twice as much as Miami flights. For example, a Portland weekday ight during the nighFme is $200. A Chicago weekend ight during the day0me is $90.

Your program is to work as follows:

1.   Display a welcome message (e.g., “Welcome to Fordham Airlines!”)

2.   Prompt the user to input his/her des0na0on: Chicago, Miami, or Portland (I recommend you use leZers to represent each input)

3.   Prompt the user to input what 0me s/he wishes to travel (in army 0me, e.g., 800 for 8am or 1530 for 3:30pm)

4.   Prompt the user to input what type of day (s) s/he is traveling: Weekday or Weekend (I recommend you use leZers to represent each input)

5.   Report the price per 0cket of the specied type

6.   Prompt the user for the number of 0ckets to be purchased

If the number of 0ckets is fewer than 0, report that the number of 0ckets ordered is invalid and the order has been cancelled, then exit; otherwise:

7.   Compute and display the total amount due (no sales tax this 0me!)

8.   Prompt the user to enter the amount s/he is paying

If the amount paid is less than the amount due, report that the amount paid is too liZle and the order has been cancelled, then exit; otherwise:

9.   Display change and conrm the order has been placed

Two example execu0ons of the 0cket program are given at the end of this document.

For this lab you must use:

At least one if-else statement

At least one constant variable (for example: const int a=42;)

Good coding style (comments, spacing, good variable names) --- it counts for 30% of your grade!

I recommend you look over the programming advice I have placed on our lab website as well, to help as you write and debug. As you write your program, it is wise to make sure you can make a program that performs the first 4 steps before you work on step 5, that you can make a program that performs the rst 5 steps before you work on step 6 and so on.

Example execu0on:

$ ./fordhamAir.out

Welcome to Fordham Airlines

What is your destination? ([C]hicago, [M]iami, or [P]ortland) P

What time will travel? (Enter time between 0-2359) 450

What type of day are you traveling? (week[E]nd or week[D]ay) E

Each ticket will cost: $240.00

How many tickets do you want? 2

You owe $480.00

How much will you pay? 100.00

That is too little! No tickets ordered.

Another example execu0on

$ ./fordhamAir.out

Welcome to Fordham Airlines

What is your destination? ([C]hicago, [M]iami, or [P]ortland) M

What time will travel? (Enter time between 0-2359) 1345

What type of day are you traveling? (week[E]nd or week[D]ay) D

Each ticket will cost: $150.00

How many tickets do you want? 3

You owe $450.00

How much will you pay? 500.00

You will get $50.00 in change.

Your tickets have been ordered!