Assignment A2
Due Date: Thursday June 15th
General Instructions:
Your classes should have main method that automatically executes the program (obviously)
Your classes should be named after the exercise name: Program1, Program2, …
Exercise Name: Program1
Write a Java application which reads bytes from the keyboard until encountering the # character. Echo each character to the screen as it is read. Terminate the program when the user enters the # character.
Exercise Name: Program2
Write a Java application that puts the following prompt on the screen:
Enter some text, terminate with #
Then it echoes each character that you enter.
When you press the Enter key. However, it doesn’t echo the # character.
When you enter the # character, the program terminates and displays your name.
Answer the following question on a separate sheet of paper:
Does your program insert extra blank lines? If so, can you explain why?
Exercise Name: Program3
Write a java application that wraps the value 3.14 in a Double object, and then displays two times the value using the doubleValue() method of the object.
Also have the application create a primitive double variable containing 3.14 and display twice the value contained in the variable without using a wrapper.
Provide appropriate text in the output. Also display your name on the screen along with a terminating message.
Exercise Name: Program4
Write a Java application that illustrates the use of member variables, local variables, and method parameters.
Make all of them type double.
Illustrate two different member variables: a class variable and instance variable.
Display each of them along with appropriate text, and also display a terminating message along with your name.
Exercise Name: Program5
Write a Java application that clearly illustrates the difference between the prefix and the postfix versions of the increment operator.
Provide a termination message that displays your name.
Exercise Name: Program6
Write a Java application that illustrates the use of the following relational operators: < > <= >= == !=
Provide appropriate text in the output. Also provide a termination message with your name.
Exercise Name: Program7
Write a Java application that illustrates the use of the following logical or conditional operators: && || !
Provide appropriate text in the output. Also provide a termination message with your name.
Exercise Name: Program8
Write a Java application that increments a counter from 1 to 10 and prints to the screen the successive values of the variable representing the counter.
Use a for-loop to iterate.
Provide appropriate text in the output. Also provide a termination message with your name.
Exercise Name: Program9
Write a Java application that increments a counter from 1 to 10 and prints to the screen the successive values of the variable representing the counter.
Use a while-loop to iterate.
Provide appropriate text in the output. Also provide a termination message with your name.
Exercise Name: Program10
Write a Java application that increments a counter from 1 to 10 and prints to the screen the successive values of the variable representing the counter.
Use a do-while-loop to iterate.
Provide appropriate text in the output. Also provide a termination message with your name.
Click here to order this paper @Superbwriters.com. The Ultimate Custom Paper Writing Service