Assignment title: Information


Assignment  Electronic copy in zip file must be submitted on or before the due date. File name format: name_ID_OOP, for example, if your name is David Tan and your ID is s1237894A, and then the file name will be David_Tan_s1237894A_OOP. a) Your soft copy should consist of 1 to 2 pages of item (1) to (6) above in MS word format. b) The rest should be your separate C++ file for the assignment. INDENT!!!!!!! You will lose some points if your code isn't indented well. This is crucial in program readability. You are supposed to write C++ program for the following questions. For every question, do provide at least THREE (3) different test cases. Question 1 Write a program that reads a string from the keyboard and tests whether it contains a valid date. Display the date and a message that indicates whether it is valid. If it is not valid, also 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. Question 2 Write a 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. Question 3 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.