Question: Help with simple creating simple java code for math problem This is the code I had used for the HW4 so how do i Update

Help with simple creating simple java code for math problemHelp with simple creating simple java code for math problemThis is theThis is the code I had used for the HW4 so how do i Update it to complete what it is asking of me for hw 5

public static void main(String[] args) { // TODO code application logic here Scanner in = new Scanner(System.in); System.out.print("Enter dollar amount = "); int dollars = in.nextInt();

int dollars_100 = dollars / 100; dollars %= 100; int dollars_50 = dollars / 50; dollars %= 50; int dollars_20 = dollars / 20; dollars %= 20; int dollars_10 = dollars / 10; dollars %= 10; int dollars_5 = dollars / 5; dollars %= 5;

System.out.println("Number of $100 bills = " + dollars_100); System.out.println("Number of $50 bills = " + dollars_50); System.out.println("Number of $20 bills = " + dollars_20); System.out.println("Number of $10 bills = " + dollars_10); System.out.println("Number of $5 bills = " + dollars_5); System.out.println("Number of $1 bills = " + dollars);

Comme No Con Use only the code you submitted for hw4 to do hw5. Write a generic code to compute the least number of dollar bills. The available number of $100 bills are 2 and the available number of $50 bills are 3. There are unlimited number of $20, $10, $5 and $1 bills. User Input: Enter dollar amount = 666 Expected Output: Number of $100 bills = 2 Number of $50 bills = 3 Number of $20 bills = 15 Number of $10 bills = 1 Number of $5 bills = 1 Number of $1 bills = 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!