Change Calculator

View as PDF

Submit solution

Points: 3
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type
Allowed languages
Java

Anatoly wants to count the amount of change in his pocket to determine if he has enough money for buy TimBits for the next Computer Club meeting (every Thursday in room 221). Given the coins that he has, determine the total cent value of all of them.

Methods

Your program should define and implement the following methods:

A getCents method that takes the following parameters:
  • An int representing the number of quarters Anatoly has.
  • An int representing the number of dimes Anatoly has.
  • An int representing the number of nickels Anatoly has.
  • An int representing the number of pennies Anatoly has.

The method should return an int representing the cent value of all the coins taken as parameters.

Input Specification

There are 4 lines of input representing the number of quarters, dimes, nickels and pennies in that order. There will never be more than 1000 of any given coin.

Output Specification

Create and call the method outlined above in order to find the total cent value of the coins and print it.

Sample Input

2
1
5
6

Sample Output

91

Comments


  • 0
    aiden  commented on Dec. 4, 2023, 12:19 p.m.

    I love cs .🥵🥵🥵🥵🥵🥵🥵🥵🥵🥵🥵🥵🥵🥵🥵🥵🥵🥵🥵🥵🥵🥵🥵🥵🥵🥵🥵


    • 0
      jihojava  commented on Dec. 4, 2023, 12:22 p.m.

      Keep the change 😎😎


  • 3
    348929050  commented on April 21, 2023, 12:18 p.m.

    Problem is wrong, pennies are worth zero.🥵