Note: This lab assumes that you have completed Lab 1, and that you know how to login to your account, how to use Eclipse to create a project and open, edit, save your files, as well as compile and run your programs, and how to submit your work with the Submit tool available from the Windows desktop on the CSE PCs. If you have forgotten any of these techniques, refer back to the Lab 1 handout. Be sure to follow the directions very carefully. If you have any problems or questions, be sure to ask your instructor as soon as possible. Points will be deducted if the submitted programs are not formatted properly or do not have the appropriate comments included.
***************************************
* Welcome to your first Java program! *
***************************************
*** Test integer arithmetic ***
Enter first integer number: 201
Enter second integer number: 123
201 + 123 = 324
201 - 123 = 78
201 * 123 = 24723
201 / 123 = 1
201 % 123 = 78
*** Test real arithmetic ***
Enter first real number: 3.14159
Enter second real number: 2.718
3.14159 + 2.718 = 5.85959
3.14159 - 2.718 = 0.4235899999999999
3.14159 * 2.718 = 8.53884162
3.14159 / 2.718 = 1.1558462104488594
*** Test String operations ***
Enter a string of characters: The Lord of the Rings
The length of string "The Lord of the Rings" is 21
Enter an integer between 0 and 20: 10
The character at index 10 of string "The Lord of the Rings" is 'f'
Enter another string of characters: Lord
The first occurrence of string "Lord" in string "The Lord of the Rings" is at position 4
*** One last test ***
Enter your birthday (mm/dd/yyyy): 10/25/1983
You were born on 25-10-1983
There are five main parts to this program:
Note that the Java Scanner component used to get the inputs has a somewhat unexpected behavior when you have to input text after a number. This behavior is documented and explained in the textbook in the section "Mixing Calls to nextLine with Calls to Other Scanner Methods", pp. 86-89.
Important note: Part of the objective of this assignment is for your program to produce exactly the same output as the sample provided above. If you understand how the Java output statements work, you should have no problem reproducing the above interaction. This is a requirement to earn full credit for this lab assignment.