## A cashier distributes change using the maximum number of five dollar bills, followed by one dollar bills. For example, 19 yields 3 fives and 4 ones. Write a single statement that assigns the number of one dollar bills to variable numOnes, given amountToChange. Hint: Use the % operator.

Report
Question

### Please briefly explain why you feel this question should be reported .

2.7.2 Compute Change

A cashier distributes change using the maximum number of five dollar bills, followed by one dollar bills. For example, 19 yields 3 fives and 4 ones. Write a single statement that assigns the number of one dollar bills to variable numOnes, given amountToChange. Hint: Use the % operator.

import java.util.Scanner;

public class ComputingChange {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int amountToChange;
int numFives;
int numOnes;

amountToChange = scnr.nextInt();
numFives = amountToChange / 5;

/* Your solution goes here */

System.out.print(“numFives: “);
System.out.println(numFives);
System.out.print(“numOnes: “);
System.out.println(numOnes);
}
}

in progress 0
3 months 2023-02-28T11:08:12+00:00 1 Answer 5 views Teacher 0

```numOnes = amountToChange % 5; ```