Calculate the total value of a group of coins. Assume that the coins are the sta
ID: 3541196 • Letter: C
Question
Calculate the total value of a group of coins. Assume that the coins are the standard American coins: penny, nickel, dime, quarter.
1. You need to write a program that will calculate the total value of a group of coins. Your analysis should be clearly written and demonstrate your thought process and steps used to analyze the problem. Be sure to answer the following questions:
a) What is the required output?
b) What is the necessary input?
c) How you will obtain the required output from the given input?
Also, include your variable names and definitions. Be sure to describe the necessary formulas and sample calculations that might be needed.
Assume the following values for the coins:
Explanation / Answer
This part of question does not ask you to code but define things. So here I m doing those. Code has to be done in other section.
1. a) Required output : The total sum in dollar should be printed.
b) Required input : We need to input the count of penny, nickel, dime and quarter
Also, we need to input the value of each penny = 0.01, nickel as 0.05, dime as 0.10 and quarter as 0.25
c) We need to multiply the count of penny with value of penny + multiply the count of nickel with value of nickel + multiply the count of dime with value of dime + multiply the count of quarter with value of quarter.
variable names
int numberOfPenny (for count of penny)
int numberOfNickel ( for count of nickel)
int numberOfDime (for count of dime)
int numberOfQuarters (for count of quarter)
double balance (for the total sum)
definitions
None
forumale
balance = ( 0.01 * numberOfPenny ) + (0.05 * numberOfNickel)
+ (0.10 * numberOfDime)+ (0.25 * numberOfQuarters);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.