Programming Course in C# ¡Free!

4.19 - Friends database

 Saturday, April 06, 2013 published by Exercises C#

Create a C# program that can store up to 275 people. For each person, it should keep the following information:

• Name (max 40 letters)
• E-Mail (max 30 letters)
• Address (max 150 letters)
• Year of birth (unsigned short integer)

The program should allow the user the following four operations:

1 - Add data of a new person (it must verify that texts are not too long, and year of birth is between 1850 and 2100; if any text is too long, or the year is a wrong one, it must be re-entered).

2 - Show the names of all persons stored, each in a line. If a name is longer than 30 letters, only the first 30 letters should be shown, followed by "...". If there is no data to display, the user should be notified. If there are more than 20 people, you must pause after displaying each block of 20 names, and wait for the user to press Enter before proceeding.

3 - View all data of a certain person (from his name, which must match exactly what the user has entered, except for the case). If that person is not found, the user should be notified (this applies to all searches, not just this one).

4 - Show the names of all persons whose date of birth is between two dates indicated by the user (eg between 1980 and 1990), inclusive. It must behave correctly in the numbers are entered in a different order (eg between 1990 and 1980). All names must be shown on the same line, separated by a hyphen ("-"), without any pause.

5 - Show the names of the oldest people (who were born in the first year in our data, eg in 1920).

6 - Show all data on people whose address appears in the word (or phrase) entered by the user, case insensitive. After each record, the user must press "[Enter]" to continue, or he can type "end [Enter]" if he does not want to see more data.

X - Exit the application (as we do not use files, data will be lost).