PROGRAM FUNCTION:?You are required to write a C program that contains two parts.
ID: 640779 • Letter: P
Question
PROGRAM FUNCTION:?You are required to write a C program that contains two parts.
PART A:?Ask the user for a dollar amount and then show how to pay that amount using the smallest number of $20, $10, $5 and $1 bills. EXAMPLE?: The user enters 93 The output $20 bills = 4 $10 bills = 1 $5 bills = 0 $1 bills = 3
PART B:?Ask the user to enter two dates and then indicate which date comes earlier on the calendar.
EXAMPLE: Enter first date (mm/dd/yyyy): 3/6/2008 Enter second date(mm/dd/yyyy): 5/17/2007 The output 5/17/2007 is earlier than 3/6/2008
OUTLINE:?The outline for your program is as follows. 1. Prompt the user for the dollar amount. 2. Read the number check if greater or equal to zero. If the user did not enter an integer, treat it as an integer. If the input is less than 0, print an error message and skip to step 4. 3. Compute the smallest number of bills and print to screen. 4. Prompt the user for the first date. Read the date and check if it is valid. If it is not valid, print a suitable error message and end the program. 15. Prompt the user for the second date. Read the date and check if it is valid. If it is not valid, print a suitable error message and end the program. 6. Print the output as shown above.
Conditions for a date to be valid?: The date must be entered in the form mm/dd/yyyy.
Additional notes about the program: (a) For this assignment, your program may consist of just one function, namely main. (b) Your program should read all its input from stdin? that is, you must use the scanf function for reading the input. (c) Your program must write all its output to stdout? that is? you must use the printf and/or puts function for producing prompts, error messages and the final result. (e) Other than the validity checks mentioned in Steps 2, 4, and 5 in the program outline above, no other error checks are needed
Explanation / Answer
1)
2)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.