solution

C++ Programing

Write a modularized, menu-driven program to read a file with an unknown number of inventory records using an array of structs/objects

  • Menu (use a switch statement) options to
    • print all items in the inventory unsorted
    • print invalid records from an error file
    • quit the program
  • A user should be able to run as many times as the user wants; print the menu every time
  • Implement the menu as a switch statement using enum
  • All items are unique in the input file
  • Record
    • Item Id must be 5 characters long; maybe alpha-numeric
    • The name may contain only alpha characters
    • Quantity and price may be zero (a promotional item, an item is not in stock)
    • status value is not in the input file
  • Reading from the input file and storing the records
    • The input file has an unknown number of records of inventory items
    • one record per line in the following order: item ID, item name (one word), quantity on hand, and a price
    • All fields in the input file are separated by a tab (‘t’) or a blank (up to you)
    • the input file may be empty or has more records that your array can store- output the appropriate messages to the user
    • check for the array boundaries when storing the records
    • Only go through the file once – do not read the file once to count the number of the records, close it, and then read it again
    • Store all invalid records along with the error messages in a separate file
      • print the record first and then print the list of all errors
  • Use an array of structs or use classes
  • do not store bad records in the array of records
  • read a record into a temp struct; error-check the record and only store the record in the array of records if it is valid
 
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
Looking for a Similar Assignment? Our Experts can help. Use the coupon code SAVE30 to get your first order at 30% off!