Assignment 2 uses structured design implemented in C. Array of records (structs) with file I/O is needed. The program takes two inputs at a time. The name of a person, and, the coin value as an integer in the range 5 to 95. Input coin values should always be divisible by 5 (integer division). Names are one word strings. An example input is: Jane 30 This input line indicates that 30 cents change is to be given to Jane. Output change values need to be in multiples of 50, 20, 10 and 5 cents. The program should aim to give as much of the higher valued coins as possible. A poor solution for an input of 30 cents is to give six 5 cent coins. A better solution is to give a 20 cent coin and a 10 cent coin. Page 4 of 10 Input to the program comes from a data file called coins.txt. There can be 0 and up to 10 input lines like the example above. It is also possible to have the same name repeated in the data file but the coin values can be different. When the name is the same, it would mean the same individual. If the name is the same, your program would need to add up the coin amounts to obtain a total amount for that individual before computing the change to be given.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter8: I/o Streams And Data Files
Section: Chapter Questions
Problem 8PP: (Data processing) A bank’s customer records are to be stored in a file and read into a set of arrays...
icon
Related questions
Question

Assignment 2 uses structured design implemented in C. Array of records (structs) with file I/O is needed.
The program takes two inputs at a time. The name of a person, and, the coin value as an integer in the range 5 to 95. Input coin values should always be divisible by 5 (integer division). Names are one word strings. An example input is: Jane 30
This input line indicates that 30 cents change is to be given to Jane. Output change values need to be in multiples of 50, 20, 10 and 5 cents. The program should aim to give as much of the higher valued coins as possible. A poor solution for an input of 30 cents is to give six 5 cent coins. A better solution is to give a 20 cent coin and a 10 cent coin.
Page 4 of 10
Input to the program comes from a data file called coins.txt. There can be 0 and up to 10 input lines like the example above. It is also possible to have the same name repeated in the data file but the coin values can be different. When the name is the same, it would mean the same individual. If the name is the same, your program would need to add up the coin amounts to obtain a total amount for that individual before computing the change to be given.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Header Files
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr