Assignment #109 Refresher Challenge
Code
Name: Iaroslav Titov
Period: 7
Project Name: RefresherChallenge
File Name: RefresherChallenge.java
Date: 1/12/2015
import java.util.Scanner;
public class RefresherChallenge
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
System.out.print("What is your name? ");
String name = keyboard.nextLine();
System.out.println("\n");
int times = 5 + ( name.equals("Josh")? 0 : 5);
// Does : count as an ELSE ?
// Then do:
// int times = 10;
// if (name.equals("Josh") times -= 5;
for (int i = 0; i < times; i++ )
System.out.println(name);
}
}
Picture of the output