In class practice Conditional Statement
July 02, 2007
0. Read how to debug a java program in jGraph
1. Run the code simpleLoop.java, AverageKeyboard.java, AverageFile.java, TelephoneDigitProgram.java, FlagControlledLoop.java try debug mode.
Here is an example of the input file for AverageFile.java.
2. Programming exercise:
a. Write a program that prompts the user to input a number. The program should then output the number and a message saying whether the number is positive, negative, or zero.
b. Write a program that prompts the user to input three numbers. The program should then output the numbers in ascending order.
c. Write a program that reads a set of integers, and then finds and prints the sum of the even and odd integers.
d. Write a program that prompts the user to input a positive integer. It should then output a message indicating whether the number is a prime number. (Note: An even number is prime if it is 2. An odd integer is prime if it is not divisible by any odd integer less than or equal to the square root of the number).
e. Write a program that prompts the user to input an integer and then outputs the number with the digits reversed. For example, if the input is 12345, the output should be 54321. Your program must also output 5000 as 0005 and 980 as 089.