You are asked to write a simple C program that will accept an integer value in the range of 5-95 with values being in multiples of 5 representing the number of cents to give to a customer in their change. A negative number input will signal the exit/termination of the program. The program should calculate how many coins of each denomination and display this to the user. Valid coin values are 50, 20, 10 and 5. 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. Your solution (program and algorithm) should be modular in nature. This requires the submission of a structure chart and a high-level algorithm and suitable decompositions of each step.   Note that for this problem, the principle of code reuse is particularly important and a significant number of marks are allocated to this.  You should attempt to design your solution such that it consists of a relatively small number of functions that are as general in design as possible and you should have one function in particular that can be reused (called repeatedly) in order to solve the majority of the problem.  If you find that you have developed a large number of functions (code modules) where each perform a similar task (or have a lot of code that is repeated in the functions) then attempt to analyse your design to generalise the logic so that you have just one general version of the function (module).   Be mindful of the cohesion exhibited by the function (module). So if you have a function (module) that is doing more than one task, then cohesion is low, and, you will need to redesign to have high cohesion.

Question

You are asked to write a simple C program that will accept an integer value in the range of 5-95 with values being in multiples of 5 representing the number of cents to give to a customer in their change. A negative number input will signal the exit/termination of the program. The program should calculate how many coins of each denomination and display this to the user. Valid coin values are 50, 20, 10 and 5. 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. Your solution (program and algorithm) should be modular in nature. This requires the submission of a structure chart and a high-level algorithm and suitable decompositions of each step.

 

Note that for this problem, the principle of code reuse is particularly important and a significant number of marks are allocated to this.  You should attempt to design your solution such that it consists of a relatively small number of functions that are as general in design as possible and you should have one function in particular that can be reused (called repeatedly) in order to solve the majority of the problem.  If you find that you have developed a large number of functions (code modules) where each perform a similar task (or have a lot of code that is repeated in the functions) then attempt to analyse your design to generalise the logic so that you have just one general version of the function (module).

 

Be mindful of the cohesion exhibited by the function (module). So if you have a function (module) that is doing more than one task, then cohesion is low, and, you will need to redesign to have high cohesion.

Expert Answer

Want to see the step-by-step answer?

Check out a sample Q&A here.

Want to see this answer and more?

Experts are waiting 24/7 to provide step-by-step solutions in as fast as 30 minutes!*

*Response times may vary by subject and question complexity. Median response time is 34 minutes for paid subscribers and may be longer for promotional offers.
Tagged in
Engineering
Computer Science

Programing Language

Related Computer Science Q&A

Find answers to questions asked by students like you.

Q: Think Critically 3-1: Configuring Zones You have an Active Directory forest named csmtech.local and ...

A: Setting up of DNS server and zones to handle the given situation:Consider the following 2 scenarios ...

Q: Using the gate diagram below, create an equivalent Boolean equation along with a truth table.Simplif...

A: As given in the gate diagram,there are following gates are used:NOT gateAND gateOR gateXOR gateYou c...

Q: I am having trouble writing a python program that opens a file that contains baby names. One file fo...

A: To run this code, make all the files Boys.txt, Girls.txt and .py files in same folder.input() is use...

Q: What is a hot spot and what are the benefits and cons?

A: Hotspot:A physical location that can obtain an internet access using Wireless Fidelity (Wi-Fi) is ca...

Q: Beacon frames in the frequency hopping spread spectrum variant of 802.11 contain the dwell time. Do ...

A: NO,  as we know the Bluetooth frame has dwell time of 625p sec for basic data rate in the frame its ...

Q: Please explain, as simplistically (but thoroughly) as possible, how to develop a k-map from a truth ...

A: Rules to be followed to simplify the Boolean expression are given below-

Q: Which of the following is not included in a ScreenTip for command? a. Link to a help topic on the co...

A: ScreenTip:ScreenTip is a User Interface feature.It is a small popup window appears while the mouse c...

Q: Write the code to assign the value 10 to an variable named a

A: The Java code is given below to assign the value 10 to a variable named ‘a’. There are two ways to a...

Q: please solve this in python  //////////////// ////////////////   ////////////////   ////////////////

A: Program Instructions:Create three functions namely top(), body() and word() to print the different p...

Q: Databse SQL Queries. Need to write the SQL code for pulling the total cost of our inventory. We have...

A: A SQL query is to be written that will give the total cost of inventory. Two tables are given named ...

Q: In addition to virtualization, concurrency and persistence, name two more major goals of operating s...

A: Major goals of Operating System are:VirtualizationConcurrencyPersistenceDistributionAbstraction

Q: Fill in the blanks in the scheduling table. One schedule has been started for you. Each column repre...

A: FIFO (First in first out) scheduling algorithm is a non-preemptive algorithm which executes the proc...

Q: http://codecheck.it/files/19090511007zak2isnw4afoevi9wybzitkv   please help me solve this problem in...

A: In python the given patterns can be printed by usinginput functionfor looprange()print ()The input()...

Q: If you are not able to specify the output of the above program exactly, explain why.

A: The sample output of the given program is:

Q: I need this for my programming lab. It’s python.   Given three String Variables that have Been given...

A: String in python are arrays of bytes representing Unicode characters. however, Python does not have ...

Q: How many lines does his algorithm print? Write a recurrence and solve it.function printaton(n: an in...

A: The given program splits into three subprograms with half of the input size each and then prints n^4...

Q: I dont understand whats going on Its hard for me to read whats happening and what the output will be...

A: Click to see the answer

Q: The category of operating system used for handheld devices.

A:  Handheld DevicesA handheld device is an electronic or a computing device that can be carried in our...

Q: Write a program that begins by reading a number of cents from the users as an integer (this is input...

A: Initialize all required currency named variable with 0 in python3 programming language so that the u...

Q: Briefly discuss the advantages and disadvantages off frequent software upgrades

A:  Advantages of frequent software upgrades:Software upgrades can increase the performance of the syst...

Q: Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both doubles...

A: Program Instructions:Take car's miles/gallon and gas dollars/gallon as input using scanner class.Cal...

Q: Draw the truth tables for the following Boolean expressions. xy+yz+xz x¯y+yz¯+x¯z (x⊕y)+(y⊕z)+(x...

A:  The logic gates are basically an elementary building block of the digital circuits. Logic gates are...

Q: Please help me solve this problem

A: Note: The Python program is coded as the user requirements.In Python, code indentation is very impor...

Q: 2. Write a Python program that can convert a Fahrenheit temperature to Celsius, or vice versa. The p...

A: A Python program that can convert a Fahrenheit temperature to Celsius or vice versa, is given below;...

Q: Show the binary representation for the phrase " University of Akron."

A: Binary is a base 2 system that uses only two digits 1 or 0. Computer store data and perform operatio...

Q: In C++ 1.  Create function called DoubleFillArray that takes in an empty array of size 100 and fills...

A: Program Instructions:In function DoubleFillArray, use rand() method to fill random numbers with doub...

Q: Provide a situation that encompasses Availability in the CIA triad

A: Answer:Situation of Availability:Availability comes under the C.I.A (Confidentiality Integrity Avail...

Q: USING THE CYK ALGORITHM, prove that the String w= abbbaa is in the language / the member of the give...

A: Given a context-free grammar: G and a string w– G = (V, ∑, P, S)where » V  is finite set of variable...

Q: Discuss whether barcodes are more or less secure than magnetic stripe cards

A: A barcode is square or rectangular lines that consists of black lines and white spaces of different ...

Q: Assume you are writing code to maintain a linked list. You are to usea variable named head to always...

A: Create a class with name Linked_list and the within that class create rest of the classes a static t...

Q: Which one of the following is NOT true with arc implementation of the super- and sub-typeentitiesA) ...

A: When the subtypes were modeled as standalone entities with each one having as is subtype of or is su...

Q: ASSIGNMENTWrite a Java program that meets these requirements.• Create a NetBeans project named Lastn...

A: Here we create an XML file that contains:<?xml version="1.0" encoding="utf-8" ?><quiz>&l...

Q: First, launch NetBeans and close any previous projects that may be open (at the top menu go to File ...

A: Click to see the answer

Q: 1. Write a program in Python named filemaker.py that will be used to store the first name and age of...

A: This python program asks user to enter First name and Age of a number of friends. This program name ...

Q: Please make a k-map to simplify the given boolean equation (and list the final simplified expression...

A: Convert the given expression into SOP canonical form:= (Y~Z + ~YZ + ~Z) ~(X + Y) + ~(Y~Z + ~YZ + ~Z)...

Q: My C++ program is supposed to check if a string input is in descending order. When I try to run it, ...

A: The given C++ code has few logical errors due to which it is not resulting the correct output. Revis...

Q: in python program4_4.pyWrite a program that prompts the user to enter a series of strings, but with ...

A: Program code:

Q: In a file called SkipMultiples.java, write a program write a program satisfying these specs: It ask...

A: // This JAVA program takes 2 inputs from user, namely low and high. // and prints all integers start...

Q: Is a honeypot entrapment or is it a way of observing the details of illegal computer activities?

A: Honeypot:A honeypot is a computer security mechanism set up as a decoy for luring malicious attacker...

Q: In C++ Create a function that takes in an array and outputs the min, max and average of the array to...

A: A function is to be created in C++ that will take in an array and will results with minimum, maximum...

Q: I need some help arranging these countries in a C++ program : China: 1,433,783,686 India: 1,366,417,...

A: Program AlgorithmDeclare two arrays named country and population of size 14.Using for loop enter the...

Q: Suppose you have two tables: EMPLOYEE and EMPLOYEE_1. The EMPLOYEE table contains the records for th...

A: Two tables are given named as EMPLOYEE and EMPLOYEE1. Each table has its records. EMPLOYEE table has...

Q: Use the class provided, TestOverloadCall printMax to print the highest of 33 and 89Call printMax to ...

A: Program:public class TestOverload{    public static void main(String[] args)    {      printMax(33,8...

Q: Provide a situation that encompasses Integrity in the CIA triad

A: DefinitionIntegrity plays the foremost role in CIA triad. It is designed to secure the data from an ...

Q: D

A: D) The language of the DFA is R(3) 13 . By using the values from question C, we can write the regula...

Q: Explain pipelining and think of a real-world analogy to the concept as if you were explaining it to ...

A: Pipelining:Pipelining is the technique of dividing a sequential process into sub-processes, each sub...

Q: E

A: E) The transition diagram for the given DFA is shown as:

Q: OF 2019 x + X PG Difference between two given ti https://moodle.oakland.edu/plug X fn Course: CSI-14...

A: Program in C to calculate the order price by entering number of books, price of a book, tax per book...

Q: Can a python programmer write a program that takes a picture of its own source code and then hides a...

A: Python is a general purpose, interpreted, high level programming language that is used for developin...

Q: Write a Java class, XXX_Lab71, where XXX is your Kean email ID. The classwill do the following:1) Cr...

A: Program://definition of classclass XXX_Lab71{  //definition of main method  public static void main(...