Write a pesudocode for the following code: public class EOM1 { public static void main(String[] args) { DecimalFormat f = new DecimalFormat("0.00"); Scanner SC = new Scanner(System.in); System.out.println("Enter the price of object: "); double amountDue = SC.nextDouble(); System.out.println("Enter cash given to cashier: "); double amountCash = SC.nextDouble(); double changeDue = amountCash - amountDue; int change = (int) (Math.ceil(changeDue*100)); int dollars = Math.round((int)change/100); change=change%100; int quarters = Math.round((int) change/25); change=change%25; int dimes = Math.round((int)change/10); change=change%10; int nickels = Math.round((int)change/5); change=change%5; int pennies = Math.round((int)change/1); change=change%1; System.out.println("Dollars: " + dollars); System.out.println("Quarters: " + quarters); System.out.println("Dimes: " + dimes); System.out.println("Nickels: " + nickels); System.out.println("Pennies: " + pennies);
Write a pesudocode for the following code:
public class EOM1 {
public static void main(String[] args) {
DecimalFormat f = new DecimalFormat("0.00");
Scanner SC = new Scanner(System.in);
System.out.println("Enter the price of object: ");
double amountDue = SC.nextDouble();
System.out.println("Enter cash given to cashier: ");
double amountCash = SC.nextDouble();
double changeDue = amountCash - amountDue;
int change = (int) (Math.ceil(changeDue*100));
int dollars = Math.round((int)change/100);
change=change%100;
int quarters = Math.round((int) change/25);
change=change%25;
int dimes = Math.round((int)change/10);
change=change%10;
int nickels = Math.round((int)change/5);
change=change%5;
int pennies = Math.round((int)change/1);
change=change%1;
System.out.println("Dollars: " + dollars);
System.out.println("Quarters: " + quarters);
System.out.println("Dimes: " + dimes);
System.out.println("Nickels: " + nickels);
System.out.println("Pennies: " + pennies);
Trending now
This is a popular solution!
Step by step
Solved in 2 steps