Write a program that reads a string from the keyboard


Assignment: Programming Java

Q1) Write a program that reads a string from the keyboard and tests whether it contains a valid date. Display a message explaining why it is not valid.

The input date will have the format mm/dd/yyyy. A valid month value mm must be from 1 to 12 (January is 1). The day value dd must be from 1 to a value that is appropriate for the given month. February has 28 days except for leap years when it has 29. A leap year is any year that is divisible by 4 but not divisible by 100 unless it is also divisible by 400.

Q2) Write a JAVA program to read a list of nonnegative integers and to display the largest integer, the smallest integer and the average of all the integers. The user indicates the end of the input by entering a negative sentinel value that is not used in finding the largest, smallest and average values. The average should be a value of type double so that it is computed with a fractional part

Q3) To make telephone numbers easier to remember, some companies use letters to show their telephone number. For example, using letters, the telephone number 438-5626 can be shown as GET LOAN. In some cases, to make a telephone number meaningful, companies must use more than seven letters. For example, 225-5466 can be displayed as CALL HOME, which uses eight letters.

Write a program that prompts the user to enter a telephone number expressed in letters and outputs the corresponding telephone number in digits. If the user enters more than seven letters, then process only the first seven letters. Also output the - (hyphen) after the third digit. Allow the user to use both uppercase and lowercase letters as well as spaces between words.

Format your assignment according to the following formatting requirements:

1. The answer should be typed, double spaced, using Times New Roman font (size 12), with one-inch margins on all sides.

2. The response also include a cover page containing the title of the assignment, the student's name, the course title, and the date. The cover page is not included in the required page length.

3. Also Include a reference page. The Citations and references should follow APA format. The reference page is not included in the required page length.

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Write a program that reads a string from the keyboard
Reference No:- TGS02953387

Now Priced at $65 (50% Discount)

Recommended (95%)

Rated (4.7/5)