Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need some help with the coding process as I keep getting repeated values and the coding language is rxvt (gedit). This is my coding

image text in transcribed

I need some help with the coding process as I keep getting repeated values and the coding language is rxvt (gedit).

This is my coding process so far and when I get the input it shows 1 quarters and then one quarter and 1 half dollars and 1 half dollar. The values are repeated in the output both with singular and plural image text in transcribed

Computer Programming Assignment #2 Modify the Example Assignment to meet the following specifications: 1. Right align output of number of each type of coin entered (up to 3 digits). 2. Prevent the user from entering a negative number of coins. 3. Do not display the coins for which the user entered zero. 4. Change the output to correctly handle singular/plural output. (ex: display 1 penny" instead of 1 pennies") Sample Output: (This is not the testcase to use when submitting for a grade) How many half dollars do you have? You can't have a negative number of coins How many half dollars do you have? -2 You can't have a negative number of coins How many half dollars do you have? How many quarters do you have? How many dimes do you have? - 2 You can't have a negative number of coins How many dimes do you have? How many nickels do you have? How many pennies do you have? You entered the following money: 1 half dollar 3 quarters 7 nickels 9 pennies These 20 coins add up to a total of $1.69 printf(" you entered the following money: "); | if (h>0) printf("%3d half dollars ", h); if (h==1) printf("%3d half dollar ", h); if(q>0) printf("%3d quarters ",q); if (==1) printf("%3d quarter ",q); if(d>) printf("%3d dimes ",d); if(d==1) printf("%3d dime ",d)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions