Question: Write a Java program MonetaryUnits.java that converts a given amount of money into smaller monetary units. The program lets the user enter an amount
Write a Java program MonetaryUnits.java that converts a given amount of money into smaller monetary units. The program lets the user enter an amount as a String value representing the total amount in dirhams and fils, and outputs a report listing the equivalent monetary units in the maximum number of 1 dirham coins, 50 fils coins, 25 fils coins, and remaining fils if any. The program should result in the minimum number of coins. Read the input as a string such as "11.79". Your program should extract the dirham amount and the fils amount using the appropriate String methods. Sample input/output Enter the amount: 11.79 Your amount 11.79 consists of: 11 dirham coins 1 50 fils coins 1 25 fils coins 4 remaining fils
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
