Homework 11 - UMBC-CMSC104/General GitHub Wiki
People database
So, for this project, I want you guys to create a database of people that you can query by last name. Call this people_db.c.
The person data should consist of:
- First name
- Last name
- Age
- Weight
- Blood Type
You should be able to take an arbitrary number of people. In your program:
- First, read the number of people to enter.
- Second, read data about each person. This should be in the order listed above. Read in first name, then last name, then age, then weight, then blood type. NOTE: You must do this in main -- you cannot use a function to accomplish this functionality.
- Third, allow the user to search through the people by last name, and return all of the information about the person found. Assume there will be only one person per last name in this database. Also, assume names are capitalized properly. You do not have to search in a case insensitive manner. This should be using a loop.
Here's some example output:
Welcome to PeopleDB!
How many people should will be in the database? 3
Please enter person 1's first name: Michael
Please enter person 1's last name: Wilson
Please enter person 1's age: 27
Please enter person 1's weight: 170
Please enter person 1's blood type: B
Please enter person 2's first name: John
Please enter person 2's last name: Doe
Please enter person 2's age: 34
Please enter person 2's weight: 155
Please enter person 2's blood type: AB+
Please enter person 3's first name: Jane
Please enter person 3's last name: Eyre
Please enter person 3's age: 23
Please enter person 3's weight: 120
Please enter person 3's blood type: O
Now the database is ready to be queried!
Type "quit" to exit.
Please search for a last name: Marco
Marco is not found! Please try another one
Please search for a last name: Doe
Doe found!:
Name: John Doe
Age: 34
Weight: 155
Blood type: AB+
Please search for a last name: quit
Thanks for using PeopleDB!
To compile:
gcc people_db.c -o people_db
To submit:
submit cs104_wilson hw11 people_db.c
Extra credit opportunities
- Make the search case insensitive. Note: The strcmpi we went over in class is not in the version of C present on the Linux systems, which I found out to my dismay. You will have to look into using a function like tolower().
- Allow people with multiple last names.
- Allow searching on first names as well as last names.