CS3100/5100: Data Structures and Algorithms Programming Assignment #1 Solved

45.00 $ 22.50 $

Category:

Description

  1. Overview

The objective of this programming assignment is to practice your C++ programming skills. For this assignment, you will retrieve a specified number of employee records from an input file, and write these employee records into the output file, and simultaneously output these employee records onto the screen. You should begin by creating class Employee, which will contain information about a single employee (see below). Then you can open a file for input to read retrieve a specified number of employee records from an input file, and write these employee records into the output file, and simultaneously output these employee records onto the screen. An Employee record should support the following fields: Last Name (string), First Name (string) and Employee ID (integer). I will provide a data file that contains lines with three items: Last Name, First Name and Employee ID. Last Name, First Name and Employee ID are separated by spaces. The valid Employee ID is a number from 0 – 9999999. The header file Employee.h will be provided to you.

You must implement all the member functions of employee.h in employee.cpp. In the main.cpp, you want to provide the following menu.

  • Read — retrieve a specified number of employee records from an input file, and output these to the screen
  • Test if two employees are the same.
  • Test if one employee’s ID is less than another employee’s ID
  • Write – Write an employee or multiple employees got from the keyboard to the output file and simultaneously output it to the screen
  • Quit
  1. To test your program, a file “Small-Database.txt” with many employee records are provided to you. In your main.cpp, you will write code to implement all these functionalities. In your main.cpp, you should open the input file, and output file first, and then you will provide a user interface (MENU) to prompt the user to choose what to do, (1) read the employee records from Small-Database.txt, and simultaneously output these employee records onto the screen, (2) Test if two employees are the same  (3) Test if one employee’s ID is less than another employee’s ID (4) Test if one employee’s lastname is the same as another employee’s (5) Write – Write an employee got from the keyboard to the output file and simultaneously output it to the screen (6) quit. The number of employee records read and write should be specified from the keyboard (in the range of 1 – 99) . You should print out a message describing the operation you tested.

Then in your main() function, you will provide a user interface (MENU) to test the member functions of the stack ADT and to support the following operations:

  • Retrieve — retrieve a specified number of employee records from an input file, output these employee records onto the screen
  • Test if two employees are the same.
  • Test if one employee’s ID is less than another employee’s ID
  • Write – Write an employee or multiple employees got from the keyboard to the output file and simultaneously display these employees to the screen
  • Quit: close all the files, and quit.

 

  1. Requirements

The main.cpp file includes code that will open file, close file, provide a user interface (MENU), and test all the functionalities specified in the MENU. In the beginning of the main.cpp, you should test all the member functions of Employee.h. Any untested member function will lose points.

In employee.cpp, you must implement all the member functions specified in Employee.h.

Your code should follow the Code Standards posted on Pilot. Your code will be graded according to its correctness, efficiency, organization, and readability.

  1. Make sure that each file includes your name and email address in the header comments.
  2. Code Submission and Testing

 

  1. The grader will test your source code using visual studio 2019. It is suggested that you test your source code on the computers located in the computer labs in the first floor of Russ Engineering building before you submit your code on Pilot.

 

  1. You must submit an ELECTRONIC COPY of your source program through Pilot before the due date. If for some reason Pilot is unavailable, submit your source code to the instructor Meilin Liu.

 

  1. Submit the source code files including cpp, employee.cpp, employee.h, a README file. You are recommended to submit a README file to tell the instructor and the grader what they need to know when testing your program. When you submit your program assignments, please zip all the files into one zip file.

 

  1. All the submitted project files should have: Course Number / Course Title , Your Name, Prof.’s Name, Date, and the Project Name. If you did not include these required contents in your submitted files, then 5 points will be deducted. It is recommended that your filename include your last name.

 

  1. The instructor or the grader will test your programs under visual studio 2019. It is YOUR responsibility to make your programs workable and runnable under visual studio 2019.

 

  1. The programming assignment is individual. You must do the project by yourself. If you allow others to copy your programs or answers, you will get the same punishment as those who copy yours.

 

  1. Be honest. If your program does not work, SAY SO in your README. The instructor will run your programs with ANY DIFFERENT input files. If your program does not work, but you “claim” yours work, you will have severe penalty!