Data for one person is shown below: See image.

Requirements:

  • Declare a class to represent a person( include all the necessary constructors, getters, and setters, and you may want to develop some utility functions to make processing of person objects easier such as read, print, read from file, print to file,..)
  • The following functions could be class member functions or stand alone
    • Converting inches, numeric average to letter,…
    • Write (one or more) bool function(s) to verify numeric data is in range ( GPA 0-4, Weight (100-500, height 50 – 85, age 21 – 120) and not character or strings.
    • Any additional functions you like to have.
  • Produce a tabular output to a file (prompt user for file name) and monitor refer to the sample.
  • Choose meaningful names for functions and variables.
  • More functions are OK and are encouraged strongly.
  • Full documentation is required (ID block, Analysis, and Algorithm)

Sample input file: See image.

Sample output table: See image.

Create a menu driven program to simulate a simple database system. The program will open a file and reads the data and store them in an array of objects to represent the people information as it was created in the first part. The format and a sample of the file are provided above. If you are using arrays make the size 20 and if there are more people in the file print a message and only process the 20 that are stored in the array. Assume all the data stored in the file are correct, no need to verify them.

Implement the following menu:

  • 'O' -- Open an existing people file.
  • 'A' -- Add new person to the current list.
  • 'R' -- Remove a person from the current list.
  • 'P' -- Print person’s info in the current list.
  • 'E' –-Edit information for 1 person.
  • 'S' -- Search.
  • ‘T ’ -- Sort the list
  • 'X' -- Exit the program.
  • Selection:

COMMENTS :

  • For O : Prompt the user for the file name, then open it. Finally, read the entire file into the list and update the number of elements read.
  • For A : Add info for a new person if there is space in the list.
  • For R : Remove a person from the list. (Prompt user for last name)
  • For P : Show a sub-menu
    • L: Print all people’s information in the list with a page format to the monitor (refer to sample above)
    • T : Print all people’s information in the list in a table format to the monitor(refer to sample below)
    • F : Print in a table format to a file. Format is the same as T above.
  • For E: Prompt the user for the person’s last name. If name not found, print person not found message and return to main menu. If found provide a sub-menu and allow user to change any data necessary except name.
  • For S: Prompt the user for the person last name. If name not found, print person not found message and return to main menu, else return the index of the record.
  • for ‘S’ : Sort list, display a sub-menu:
    • ‘N’ : Sort on names (alphabetical).
    • ‘C’ : Sort on height (high to low descending).
    • ‘S’ : Sort on weight (low to high ascending) .
    • ‘B’ : Sort on net worth (Descending).
  • For X : Make sure to save the list information to the disk. Print an ending message. Then halt the program.

Required reports format: See image.

Requirements:

  • Make sure the classes are separated into header, and implementation files.
  • Include all the necessary getters, setters, constructors and any utility/helper functions you may need for the class.
  • All classes must be documented, algorithms are required only for functions that are substantial and require explanation, include UML for each class.
  • Driver program must be modular, use as many functions as possible.
  • Must use arrays or vectors to store any list used in the program.
  • You may assume there are no more than 20 people in the file, (check for overflow).
  • You may assume all names are unique, no duplicates are allowed in the list.
  • You may use any platform to develop the program, but make sure it compiles and run on UNIX before submitting it.
  • Sample data file assign6.txt is posted on BB, use it to test your program.
  • Make sure the program is user friendly.

Suggestions:

  • Start with an overall design, people list, and options (does not need to be detailed)
  • Design your UML for person class, and then implement the class and a small main driver to test the class.
    • Make sure you have all the necessary member functions:
    • Getters
    • Setters
    • Constructors
    • Utilities (such as) Read Print Process functions (convert_inches, …)
  • Create a list of people and start implementing the menu options one by one and test them as you go using the small main test driver.
    • Open file
    • Read into the list
    • Print the list
    • Process a person (add, edit, remove,…)
    • Search list
    • Sort list
  • Develop a menu function
  • Make the final main function
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.