Question
java program I want it to calculate change Need a little help to finish the program Still struggling if someone could explain what I did
java program
I want it to calculate change
Need a little help to finish the program
Still struggling if someone could explain what I did wroing and give me pointers. please try to explain to me as much as possible.
{ int dollar; // defines dollar and double is more percise and able to use decimals int amount; // defines amount of change put in double cents; // defines amount of change given back int d = 0.25; // deifines quarter amount int m = 0.10; // defines dime amount int n = 0.05; // deifines nickel amount int p = 0.1; // defines penny amount System.out.println("Enter the change amount"); double dollar = scan.nextDouble(); // returns the value of the dollar double dollar = scan.nextDouble(); // returns the value of the dollar double amount = dollars - cents; // subtracts change from dollar if ( amount =< 0.25) // needs identifier System.out.println("Quarters: " + quarters); else if ( amount == 0.25) System.out.println("Quarter: " + quarter); if amount if ( amount =< 0.10) System.out.println("Dimes: " + dimes); else if ( amount == 0.10) System.out.println("Dime: " + dime); else if ( amount =< 0.5) System.out.println("Nickels: " + nickels); if ( amount == 0.5) System.out.println("Nickel: " + nickel); if ( amount =< 0.1) System.out.println("Pennies: " + pennies); if ( amount == 0.1) System.out.println("Penny: " + penny);
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started