Q1. Write a program that takes a matrix of size N x N of positive integers as input and returns:

  • The largest number
  • The smallest number
  • The median
  • The average
  • The sum

Do not use C++ standard library. You must use pointers and pointer arithmetic to represent the matrix and to navigate through it.

Q2. Consider the following class:

/* date.h */
#ifndef DATE_H_
#define DATE_H_

using namespace std;

class Date
{
public:
Date(int = 1, int = 1, int = 2000); // sets day, month, year
void setDate(int, int, int); // sets the date
void printDate() const; // prints date to the screen
private:
int day;
int month;
int year;
};

#endif /* DATE_H_ */
/* date.cpp */
#include < iostream>
#include "date.h"

using namespace std;

// Constructor
Date::Date (int d, int m, int y)
{
day = d;
month = m;
year = y;
}

// sets date
void Date::setDate(int d, int m, int y)
{
day = d;
month = m;
year = y;
}

// prints date
void Date::printDate() const
{
cout << month << "/" << day << "/" << year << "\n";
}

a. Add a new function to the class Date that returns the month in letters (e.g., January, February, etc.).

b. Add a function that prints the date using the following format: Month dd, yyyy. Example, January 23, 2019

c. Test the new functions of the class Date by creating dynamically (i.e., using pointers) two objects of the class Date and invoking the new member functions on both objects.

Q3. Modify Q3 of Assignment 4 by changing the date of birth of employee to a pointer of type Date of the previous question. Modify the member functions accordingly. Test your class by dynamically creating two Employee objects and calling on them the class member functions.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.