Conditionals

Bob_Usher
Assignment2Conditionals.pdf

CSCD255 – C Programming for Engineers 7/3/2018

Eastern Washington University

CSCD255 Assignment 2 – Conditionals 25 points + 5 points EC (See Canvas for due date)

Grace Hopper's Museum

Your boss, Ms. Grace Hopper, has come to you with a problem. She would like a program which will allow patrons of her computer museum (what else :-) to determine their entrance fee before stepping up to the ticket window. Regular admission prices are as follows:

AGE PRICE

14 and under $5.00

15 to 64 $9.00

65 and over $7.50

In addition, Hopper's museum offers a 1-dollar-off coupon that the patron may have.

This program will first get the current date from the system, and then query the patron for his/her date of birth. The program will then ask if s/he has a discount coupon. Based on this information, the program will then calculate the patron's age and admission price and display it for the user. (Note that this means your program will calculate the user’s age.)

Here is a sample run:

Hello, welcome to Hopper's Computer Museum!

To determine your entrance fee, please enter the

following:

Your Date of Birth (mm dd yyyy)--> 10 10 2002

Do you have a discount coupon(y/n)?--> y

Your admission fee is $8.00, enjoy your visit!

CSCD255 – C Programming for Engineers 7/3/2018

Eastern Washington University

Assumptions:

 Values for dates will be entered on one line and the user will not enter a birth date that is after the current date

 Answer to coupon question will be y's or n's (type character)

Specific requirements:

 You must accept both upper and lower case answers for the coupon question  Your user interface must look EXACTLY as shown above.

Extra Credit (5 points possible!):

Screen user input so that a valid month and day is entered. To determine if a day is valid, you must first have the month (since different months have different numbers of days -- assume February has 28). If an improper value is entered, display a message that shows what value they entered and the range of values that are acceptable, then exit the program.

Turn in:

 Your .c file  If extra credit is attempted, you must specify that in the comments  name your file as usual (lastname, first initial of firstname, hw2, .c-- ex:

peterschw2.c)

GET STARTED ASAP -- There is more work to be done on this one!