0% found this document useful (0 votes)
4 views4 pages

HW05

The document outlines a programming assignment for creating C++ classes including Rectangle, Employee, and Date. It specifies the attributes and methods for each class, such as calculating area and perimeter for Rectangle, displaying employee information and salary adjustments for Employee, and validating date input for Date. The assignment emphasizes user input for certain attributes and error handling for invalid data in the Date class.

Uploaded by

maher sawsak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views4 pages

HW05

The document outlines a programming assignment for creating C++ classes including Rectangle, Employee, and Date. It specifies the attributes and methods for each class, such as calculating area and perimeter for Rectangle, displaying employee information and salary adjustments for Employee, and validating date input for Date. The assignment emphasizes user input for certain attributes and error handling for invalid data in the Date class.

Uploaded by

maher sawsak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Computer Programming II

WEEK 9
Create a class named Rectangle.
• Let the class have two variables named Length and Width.
• These variables will be obtained from the user
• Write C++ code to calculate the area and perimeter of the rectangle
by writing 2 functions with the object derived from this class.
• Create a class named Employee and keep Name, LastName and Salary
information in the class.
• Print employee information to the screen with the ShowInfo method
• IncreaseSalary method will increase the salary according to the
entered wage.
• Access the above 2 functions with the emp1 object created from the
employee class and print the information to the screen.
• Employee information will not be obtained from the user, it will be
filled in by you.
---Design a C++ class named Date that represents a date with day, month, and year.
• Requirements:
• Add member variables for day, month, and year (all integers).
• Provide a constructor that takes three arguments: day, month, and year.
• these arguments will be entered by the user
---Implement the following functions:
• Verify the date during construction. A valid date must comply with these rules:
• The month must be between 1 and 12.
• The number of days will take up to a maximum of 31
• If the date is invalid during construction, print an error message and set the object's member
variables to default values (for example, 1 for day, 1 for month, and 1 for year).
• Add member functions to access the day, month and year (e.g. getDay(), getMonth(), getYear()).

You might also like