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

Assignment # 3: Dr. Adnan Abid

The document provides instructions for two programming tasks. Task 1 involves creating an Employee class that composes Name, Date, and Time classes. It lists the required member functions for each class. Task 2 involves completing a Person class that uses composition with a Name class and Date and Time attributes. The Person class is to have various constructor and setter/getter methods to work with the composing classes and attributes. It also requires additional methods like isEqual, olderOne, and isBirthDay.

Uploaded by

MīÅn ŘeHmăn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
99 views4 pages

Assignment # 3: Dr. Adnan Abid

The document provides instructions for two programming tasks. Task 1 involves creating an Employee class that composes Name, Date, and Time classes. It lists the required member functions for each class. Task 2 involves completing a Person class that uses composition with a Name class and Date and Time attributes. The Person class is to have various constructor and setter/getter methods to work with the composing classes and attributes. It also requires additional methods like isEqual, olderOne, and isBirthDay.

Uploaded by

MīÅn ŘeHmăn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Assignment # 3

Dr. Adnan Abid


(Composition)
Deadline: 28 October, 2018. 11:55pm
For both tasks, make a main() that uses all the functionalities of classes.
Task 1:
Your goal is to create an “Employee” class which composes other classes
such as “Name”, “Date” and “Time” in itself.
The suggested prototypes of required member functions have been listed down:

class Name
{
public Name();
public Name(String);
public void setName(String);
public String getName();
public void Display();

private String newName;


};

class Date
{
public Date();
public Date(int, int, int);
public void setDay(int);
public void setMonth(int);
public void setYear(int);
public int getDay();
public int getMonth();
public int getYear();
public void Display();

private int Day;


private int Month;

For help: Azil Fozan


Mail: [email protected]
private int Year;
};

class Time
{
public Time();
public Time(int, int, int);
public void setHours(int);
public void setMinutes(int);
public void setSecinds(int);
public int getHours();
public int getMinutes();
public int getSecinds();
public void Display();

private int Hours;


private int Minutes;
private int Seconds;
};

class Employee
{
public:
public Employee();
public Employee(Name, double, Date, Time, Time);
public void setName(Name);
public void setSalaray(double);
public void setJoining(Date);
public void setSTime(Time)
public void setETime(Time);
public Name getName();
public double getSalaray();
public Date getJoining();
public Time getSTime();
public Time getETime();

For help: Azil Fozan


Mail: [email protected]
public void DisplayEmployee();

private Name EmpName;


private double Salary;
private Date JoiningDate;
private Time StartingTime;
private Time EndingTime;
};

Task 2:
In this task you are going to have some hands on composition.
Complete the following classs.
class Person{
private Name name;
private Date dateOfBirth;
private Time timeOfBirth;
private String address;

public Person();
public Person(String, String, int, int, int, int, int, int, String);
public Person(Name, Date, Time, String address);
public Person(Name, String);//Date and Time are set to default
public Person(String, String, String);//Date and Time are set to default
public void setName();// name set to programmer's name
public void setName(Name name);
public String getName();// returns fullName
public String getFirstName();
public String getLastName();
public Name getName();
// write all versions of setter/getter for dateOfBirth and timeOfBirth attributes as written for
name
public String getAddress();
public void setAddress(String);
public void display();// display all data properly in certain format
public bool isEqual(Person); // returns true if all attributes are exactly
equal

For help: Azil Fozan


Mail: [email protected]
public String olderOne(Person); //returns the fullName of that person who
is older, if Birth dates equal then decide on Birth time, if time is equal too then
return "Same Age".
public bool isBirthDay(Date);
public bool isBirthDay(int,int,int); // other relevant methods you want
};

For help: Azil Fozan


Mail: [email protected]

You might also like