u are required to perform the following tasks: Create an Employee class with the following data members: char * name

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

QUESTION 1

  1. Write a C++ program that keeps taking input from the user about an Employee and stores them in the heap and then displays it. You are required to perform the following tasks:

    1. Create an Employee class with the following data members:
      1. char * name
      2. int age
    2. Make sure to have all the appropriate getters and setters along with a void toString() method that can display all the employee information in the form shown in the expected output screenshot.
    3. At the start of the program, it should ask user to enter Employee Name and Age. When user is done entering the information, the program should ask whether user wants to enter more employee information or not? If user presses ‘y’ or ‘Y’, the program should ask user to enter Employee Name and age for another employee, otherwise it should quit while displaying the report.
    4. Make sure to store the employee information in an array of employee and store it inside the heap memory on each employee entry from the user. You should start with the heap memory size of 0 and on each entry of employee name and age, an increment of heap memory size should happen so that on-demand heap memory is created for every new employee.
    5. Your program should have a resize function Employee* resize(Employee* arr, int* size) to resize the employee array in the heap on every entry of employee information from the user.
    6. Your program should have a display function void display(Employee* arr, int size) to display all the information by calling toString() method of employee class for all the objects in the employee array.
    7. Make sure to validate the input for age. For example, if user enters an invalid age (e.g., < 0), then user program should default age to 0 and inform user that age is set to 0 because of invalid entry.
    8. In display method in point (e), you should also be able to display, how many entries were corrected by the program due to invalid entries from the user. Please see highlighted parts of the output screenshot below for more information.
    9. Follow the modular programming approach to organize your code and dont forget to indent and comment your code.
    10. Below is the screenshot of the expected output of the program:

     

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Data members
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education