|
Create & name a file with the following format: LastNameFirstNameWeek3.java . Example:The instructor would create a file with the following name: DeweyKenWeek3.java Proper coding conventions required the first letter of the class start with a capital letter and the first letter of each additional word start with a capital letter. Only submit the.java file needed to make your program run. |
|
| LastNameFirstNameWeek3.javaUse the Scanner class to accept input from the user.Prompt the user for their first name, last name, and age each individually.Use string concatenation to obtain the user’s full name.Use equals() and If their first and last name are the same print: “Hello First Last, your first and last name are the same”If your first and last name are different, print: “Hello First Last, your first and last name are different”Print the length of their first name and of their full name.Use the charAt() method of the String class to find the user’s initials. Print these, followed by their ASCII value, in tabular format (see example)Print out the name per example below.Using an increment operator, increase the age by one output per example below. Do not create a new variableUsing compound assignment operators, increase the age by 4 more and output the new age. Do not create a new variable. |
90% |
|
Upload your document to the Dropbox. NOTE: Complete your activity and submit it to the Dropbox. If needed, click on the Help button above for more information on Course Tools/Using the Dropbox. |
|
|
Total |
100% |
|
Example 1 Please enter your first name: Ken Please enter your last name: Ken Please enter your age in years: 48
Hello Ken Ken, your first and last name are the same
The length of your first name is: 3 The length of your full name is: 6
Inits ASCII Value K 75 K 75 You are now 48 years old.
In one year you will be 49. In five years you will be 53.
Example 2 Please enter your first name: Ken Please enter your last name: Dewey Please enter your age in years: 48
Hello Ken Dewey, your first and last name are different The length of your first name is: 3 The length of your full name is: 8 Inits ASCII Value K 75 D 68 You are now 48 years old. In one year you will be 49. In five years you will be 53. |