For example, if the program randomly generates the number 57, then the program should output something like this:
The change of 57 cents yields 2 quarters, 1 nickels and 2 pennies.
I cant figure it out exactly here is what I have
import javax.swing.*;
import java.util.Scanner;
import java.util.Random;
// Generate random #
public class pppp {
public static final void main(String[] args){
//note a single Random object
Random randomGenerator = new Random();
for (int idx = 1; idx <= 1; ++idx){
int randomInt = randomGenerator.nextInt(100);
log("random # is : " + randomInt);
}
}
private static void log(String aMessage){
System.out.println(aMessage);
int num;
int qwater = num /25;
int nikle = num /10;
int dime = num /5;
int peny = num /5;
System.out.println ("qwaters: " + qwater );
System.out.println ("nikle: " + nikle );
System.out.println ("dime: " + dime );
System.out.println ("peny: " + peny );
}
}

New Topic/Question
Reply




MultiQuote





|