Difference between revisions of "Beginner Java Exercises"
From WLCS
(→AddSquares) |
m (Reverted edits by Ysukivewug (talk) to last revision by Admin) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 10: | Line 10: | ||
# Your program should output the minimum, the median, the maximum, and the average of the three numbers. Please make your output pretty. | # Your program should output the minimum, the median, the maximum, and the average of the three numbers. Please make your output pretty. | ||
− | === | + | === AddEvens === |
# Create a Java class named AddEvens. | # Create a Java class named AddEvens. | ||
# Create a local integer variable in the main method and prompt the user for its value | # Create a local integer variable in the main method and prompt the user for its value | ||
# The program will output the sum of all the even numbers from 0 through the number you hardcoded. (HINT: use a loop) | # The program will output the sum of all the even numbers from 0 through the number you hardcoded. (HINT: use a loop) |
Latest revision as of 13:53, 29 November 2010
OddOrEven
- Create a class named OddOrEven
- Prompt the user for an integer
- Print out to the user if the number is odd or even
NumberFun
- Create a class named NumberFun
- Declare three local variables in your main method, name them x, y, and z
- Prompt the user for x, y, and, z
- Your program should output the minimum, the median, the maximum, and the average of the three numbers. Please make your output pretty.
AddEvens
- Create a Java class named AddEvens.
- Create a local integer variable in the main method and prompt the user for its value
- The program will output the sum of all the even numbers from 0 through the number you hardcoded. (HINT: use a loop)