Question: /* Problem 1 Write and run a java program that does the following: a) Declares a string object that prompts the user to enter hisher
/* Problem 1 Write and run a java program that does the following: a) Declares a string object that prompts the user to enter his\her boyfriend's\girlfriend's first name, nickname, and last name. ( My boyfriend first name is Ali and his last name is Alawami) Nickname: Alio b) Print the first name, nickname, and last name entered. c) Use the length() method to print the length of the string. d) Use the charAt() method to print the first character in the string. e) Use the chartAt() and length() methods to print the last character in the string. f) Use the indexOf() and the substring() methods to print the first word in the string. Note: To enter a string using the scanner method, you may use the command: String nameOfString = input.nextLine(); where nameOfString is the name you assign the string you want to enter. To print the first word in the string using indexOf() and substring() methods, you begin at index 0 and use ' ' in the indexOf method. A sample run might look like: Enter name and nickname of girlfriend or boyfriend: Juliet Oooh Juliet Name and nickname entered is: Juliet Oooh Juliet First character of the string is J Last character of the string is t First word in the string is Juliet */ /* Problem 2 * Write and run a java program that prompts the user to enter the 8 digit alpha-numeric code for a CSET course offered at the University of Toledo, extracts the first 4 characters, and the last 4 characters as separate strings, and prints the complete course name. A sample run should look like this: Enter an 8-digit alphanumeric course name: CSET1200 You entered: CSET1200 The first 4 characters are: CSET The last 4 characters are: 1200 The complete course name is: CSET1200 */
For Problem 3 and 4 you can find them in the Textbook: Introduction to Java Programming, Tenth Edition, Y. Daniel Liang
/* Problem 3 Solve programming excercise 4.21 in page 155 of the textbook BUT MODIFY it so that the user enters a date in the format DD-MM-YYYY, where D,M, and Y are digits. Your program should check whether the input is valid. Here are sample runs: Enter a date in the format DD-MM-YYYY: 01-27-2017 01-27-2017 is a valid date. Enter a date in the format DD-MM-YYYY: 0155-237-2017 0155-237-2017 is not a valid date! /* Problem 4 Solve programming excercise 4.25 in page 156 of the textbook BUT MODIFY IT so that a vehicle's number plate consits of 1 uppercase letter, 2 lowercase letters, followed by 6 digits. */
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
