Tuesday, November 1, 2011

Challenge 028’s Solution

To complete Challenge 28, the following code must be pasted into BlueJ™:
 
import java.util.Scanner;

public class Challenge028
{
    public static void main(String[] args)
    {
        Scanner scanUserInput = new Scanner(System.in);
        System.out.print("Current Grade (%): ");
        int n = scanUserInput.nextInt();
        if (n >= 70)
            if (n >= 80)
                if (n >= 90)
                    System.out.println("Excellent!");
                else
                    System.out.println("Good!");
            else
                System.out.println("Average.");
        else
            System.out.println("Bad Times!");
    }
}
 
Pasting this code into BlueJ™ will produce the same scenario as in your original blog post.
 
−Phoenix

1 comment:

  1. Notable strategy in the way you do your range analysis, great work. 50 XPs awarded for this completion.

    ReplyDelete