Assignement: For Loop Refresher
Code
/// Name: Sean Harrison
/// Period: 7
/// Program name: Refresher
/// File Name: Refresher.java
/// Date Finished: 4/22/2016
import java.util.Scanner;
public class Refresher
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
String name;
System.out.print( "What is your name: " );
name = keyboard.next();
if ( name.equals("Josh"))
{
for ( int x = 0; x <= 5; x++ )
{
System.out.println( name);
}
}
else
{
for ( int x = 0; x <= 10; x++ )
{
System.out.println(name);
}
}
}
}
Picture of the output