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

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter9: Using Classes And Objects
Section: Chapter Questions
Problem 1CP: In previous chapters, you have created programs for the Greenville Idol competition. Now create a...
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
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage