Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ //Date Class: #pragma once #include using namespace std; class Date { unsigned int day; unsigned int month; unsigned int year; public: Date(unsigned int d=1,

C++
image text in transcribed
image text in transcribed
//Date Class:
#pragma once #include  using namespace std; class Date { unsigned int day; unsigned int month; unsigned int year; public: Date(unsigned int d=1, unsigned int m=1, unsigned int y=1900) :day(d), month(m), year(y) { if (month > 12) month = 12; if (month == 2 && day > 28) day = 28; else if ((month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) && day > 31) { day = 31; } else if (day > 30) { day = 30; } } unsigned int get_day() const { return day; } unsigned int get_month() const { return month; } unsigned int get_year() const { return year; } void set_day(unsigned int day_) { day=day_; } void set_month(unsigned int month_) { month=month_; } void set_year(unsigned int year_) { year=year_; } void print_details() const { cout  
 
 
 
//Customer Class
#pragma once #include  using namespace std; class Customer{ private: int id; string name; public: Customer (int id_=0 , string name_="No name"):id(id_) ,name(name_){ } void set_id(int id_){ id=id_; } void set_name(string name_){ name=name_; } int get_id(){ return id; } string get_name(){ return name; } ~ Customer() { } void print_details (){ cout
The following diagram illustrates the classes you will implement in this lab and their relationships. \begin{tabular}{lll} \multicolumn{1}{c}{ Date } & RestaunantOrder & MertOrder \\ (-) day: unsigned int & () restaurant_name : string & (-) items: * string \\ (-) month: unsigned int & () meal_nane : string & () items price :- int \\ (-) year: unsigned int & (+) parameterized Constructor () sige : int \\ (+) parameterized Constructor (+) setters & (+) parameterized Constructor \\ (+) setters & (+) getters & (+) setters \\ (+) getiers & (+) print_details ; void & (+) getters \\ (+) print_details ; void & & (+) caleulate_total: void \\ & & (+) print_details ; void \end{tabular} Ex 1. Driver Class Implement Class driver as described in the UML diagram above. Ex 2. Order Class Implement Class Order as described in the UML diagram above. Notice that, driver, customer, date protected and not private in this class. Ex 3. RestaurantOrder class Implement class RestaurantOrder , which inherits from class order . Note the following: 1- Parameterized constructor that receives all data members including data members in the base class. 2- print details 0 of the base class should be overridden to print the additional information about the restaurant_name and meal_name . Ex 3. MertOrder class Implement class MertOrder, which inherits from class order . Note the following: 1- Parameterized constructor that receives all data members including data members in the base class. 2- In calculate total 0 , you have to sum all the prices of the items and store the result in price. 3- print_details 0 of the base class should be overridden to print the additional information about the items and items price. 4- There are three things that must be defined inside the MertOrder class that are not explicitly requested and must exist. What are they? Define two of them within the class. Ex 4. Driver Implement a driver program to test your code. 1- Create an object of type Date, Customer, Driver 2- create an object of type Order using created in 1. 3- create an object of type RestaurantOrder and MertOrder . 4- set the price of RestaurantOrder object to 50 . 5- print the detail of order object and MertOrder object. 6- if you use private or protected inheritance, which part of your code is going to be wrong? why ? Answer this part as a comment in your main

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Multidimensional Array Data Management In Databases

Authors: Florin Rusu

1st Edition

1638281483, 978-1638281481

More Books

Students also viewed these Databases questions

Question

Distinguish between formal and informal reports.

Answered: 1 week ago