Write a program that: 1. Prompts the user to input the number of buckets of change to calculate. 2. For each bucket, prompts the user to input some amount of monetary change. 3. Uses a new typedef struct and user defined functions to calculate the coins the change represents. 4. Finds the bucket of change with the most coins from the input provided. 5. Outputs the results, as shown below. Your program will need 1 new typedef: • named change, with a struct named change_struct • contains 5 data members (all integers): • quarters, dimes, nickles, pennies o numCoins Your program will need the following 3 functions: GetChange o has a change array and an int parameter uses a for loop to: • prompt the user to enter the amount of change • call ComputeChange to fill the array, passing the user input as an argument • ComputeChange o has one int parameter o calculates the coins the change represents (calculate quarters first, then dimes, then nickels, etc) o returns a change struct to the calling function PrintChange • (output text provided in starter code, just change TBD values) has a change parameter o prints all the data members of the chage struct with the most coins Within your main function you will need to: • prompt the user to enter the number of buckets • create an appropriately sized array of change structs • use GetChange and CalculateChange as described above to prompt for and read data into the array use a for loop to find the bucket with the most coins use PrintChange to print the struct with the most coins, as shown below NOTES: Be sure to include your function prototypes before your main function, and your function definitions after your main function. You DO NOT need to validate input. Sample output (sample input shown with underline): How many buckets: 2 How much change: 25 How much change: 35 Most coins found in bucket 2. Quarters: 1 Dimes: 1 Nickles: 0 Pennies: 0 Total number of coins: 2

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

C programming

Write a program that:
1. Prompts the user to input the number of buckets of change to calculate.
2. For each bucket, prompts the user to input some amount of monetary change.
3. Uses a new typedef struct and user defined functions to calculate the coins the change represents.
4. Finds the bucket of change with the most coins from the input provided.
5. Outputs the results, as shown below.
Your program will need 1 new typedef:
named change, with a struct named change_struct
contains 5 data members (all integers):
quarters, dimes, nickles, pennies
numCoins
Your program will need the following 3 functions:
GetChange
o has a change array and an int parameter
uses a for loop to:
prompt the user to enter the amount of change
call ComputeChange to fill the array, passing the user input as an argument
ComputeChange
has one int parameter
calculates the coins the change represents (calculate quarters first, then dimes, then nickels, etc)
returns a change struct to the calling function
PrintChange
o (output text provided in starter code, just change TBD values)
has a change parameter
o prints all the data members of the chage struct with the most coins
Within your main function you will need to:
prompt the user to enter the number of buckets
create an appropriately sized array of change structs
use GetChange and CalculateChange as described above to prompt for and read data into the array
use a for loop to find the bucket with the most coins
use PrintChange to print the struct with the most coins, as shown below
NOTES: Be sure to include your function prototypes before your main function, and your function definitions after your main function. You DO NOT need to validate input.
Sample output (sample input shown with underline):
How many buckets: 2
How much change: 25
How much change: 35
Most coins found in bucket 2.
Quarters: 1
Dimes: 1
Nickles: 0
Pennies: 0
Total number of coins: 2
Transcribed Image Text:Write a program that: 1. Prompts the user to input the number of buckets of change to calculate. 2. For each bucket, prompts the user to input some amount of monetary change. 3. Uses a new typedef struct and user defined functions to calculate the coins the change represents. 4. Finds the bucket of change with the most coins from the input provided. 5. Outputs the results, as shown below. Your program will need 1 new typedef: named change, with a struct named change_struct contains 5 data members (all integers): quarters, dimes, nickles, pennies numCoins Your program will need the following 3 functions: GetChange o has a change array and an int parameter uses a for loop to: prompt the user to enter the amount of change call ComputeChange to fill the array, passing the user input as an argument ComputeChange has one int parameter calculates the coins the change represents (calculate quarters first, then dimes, then nickels, etc) returns a change struct to the calling function PrintChange o (output text provided in starter code, just change TBD values) has a change parameter o prints all the data members of the chage struct with the most coins Within your main function you will need to: prompt the user to enter the number of buckets create an appropriately sized array of change structs use GetChange and CalculateChange as described above to prompt for and read data into the array use a for loop to find the bucket with the most coins use PrintChange to print the struct with the most coins, as shown below NOTES: Be sure to include your function prototypes before your main function, and your function definitions after your main function. You DO NOT need to validate input. Sample output (sample input shown with underline): How many buckets: 2 How much change: 25 How much change: 35 Most coins found in bucket 2. Quarters: 1 Dimes: 1 Nickles: 0 Pennies: 0 Total number of coins: 2
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Introduction to computer system
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education