Write a method called countCoins that accepts a Scanner representing an input file whose data is a
Question:
Write a method called countCoins that accepts a Scanner representing an input file whose data is a series of pairs of tokens, where each pair begins with an integer and is followed by the type of coin, which will be “pennies” (1 cent each), “nickels” (5 cents each), “dimes” (10 cents each), or “quarters” (25 cents each), caseinsensitively. Add up the cash values of all the coins and print the total money. For example, if the input file contains the following text:
3 pennies 2 quarters 1 Pennies 23 NiCkeLs 4 DIMES
For the input above, your method should produce the following output:
Total money: $2.09
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Building Java Programs A Back To Basics Approach
ISBN: 9780135471944
5th Edition
Authors: Stuart Reges, Marty Stepp
Question Posted: