Total Value of Coins

Submitted by: Submitted by

Views: 67

Words: 529

Pages: 3

Category: Other Topics

Date Submitted: 08/01/2014 05:11 AM

Report This Essay

Problem definition: Calculate the total value of a group of coins. Assume that the coins are the standard American coins: penny, nickel, dime, quarter.

A. Problem Analysis – Following the directions in the assignment, clearly write up your problem analysis in this section.

What is the required output?

- The total value of all of the coins input.

What is the necessary input?

- The number of pennies, nickels, dimes and quarters.

How you will obtain the required output from the given input?

- Multiply the number of each type of coin by its respective value.

Variable Used

Penny - Integer number of pennies

Nickel - Integer number of nickels

Dime - Integer number of nickels

Quarter - Integer number of quarters

Total - Float containing the total value of all of the coins

Formula Used

Total = penny + nickel + dime + quarter

For example, if there are 10 pennies, 4 nickels, 3 dimes, and 8 quarters would be

Total = 10 pennies + 4 nickels + 3 dimes + 8 quarters which is $2.60.

B. Program Design – Following the directions in the assignment, clearly write up your problem design in this section and comment your pseudocode.

The program will consist of an input module which will prompt for and get from the user the number of each type of coin, the process module which will determine the total value of the coins, and the output module which will display the total value of all the coins.

/************************************************

* Value of all the coins input *

* *

* a program that prompts the user for *

* the number of different types of coins *

* then calculates and displays to the user *

* the value of those coins together *

* *

* Written *

* Date: 00/00/00 *

* *

* Revision History: *

* *

*************************************************/...