Write a full java program to solve the following problem: Read in a sum of money
ID: 3549228 • Letter: W
Question
Write a full java program to solve the following problem:
Read in a sum of money and determine the number of quarters, dimes, nickels, and pennies represented in the cents portion. You must get an optimal mix; all pennies, for example, is not allowed.
Example
With input of 43.59 you should come up with 2 quarters, 1 nickel, 4 pennies. Variable cash is a double; the rest are integers
Before you start coding, write the algorithm first. Include this algorithm as comments in your code. Use at least one static method (e.g., call your method Coins) to implement the solution, and call it from main.
NOTE: all the methods written should be in the same java class and called from the main method.
Explanation / Answer
I have it in C++ hope it helps you #include using namespace std; #define NUMBER 3.0 int main() { double cash; // original amount of money int quarters, // number of quarters dimes, // number of nickels nickels, // number of dimes pennies; // number of pennies int change; // amount of money in coins cout > cash; coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.