Assignemnt #64
Code
/// Name: Connor Siri
/// Period: 7
/// Program Name: Counting
/// File Name: Counting.java
/// Date Finished: 11/03/2015
import java.util.Random;
import java.util.Scanner;
public class Counting
{
public static void main( String[] args )
{
Random r = new Random();
Scanner keyboard = new Scanner(System.in);
System.out.println("Type this in a message, and I'll display it ");
System.out.print("Message: ");
String message = keyboard.nextLine();
System.out.print("How many times.");
int x = keyboard.nextInt();
int n = 0;
while ( n < x )
{
System.out.println( ((n+1)*10) + ". " + message);
n++; // Without it it just repeats constantly and stays on 1.
}
}
}
Picture of the output