Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in c++ #include Item.h #include #include using namespace std; Item::Item(string name_, string manufacturer_, int ID_, int price_){ this->name_=name_; this->manufacturer_=manufacturer_; this->ID_=ID_; this->price_=price_; } void Item::setname(string name_){

in c++
#include "Item.h"
#include
#include
using namespace std;
Item::Item(string name_, string manufacturer_, int ID_, int price_){
this->name_=name_;
this->manufacturer_=manufacturer_;
this->ID_=ID_;
this->price_=price_;
}
void Item::setname(string name_){
this->name_=name_;
}
void Item::setmanufacturer(string manufacturer_){
this->manufacturer_=manufacturer_;
}
void Item::setID(int ID_){
this->ID_=ID_;
}
void Item::setprice(int price_){
this->price_=price_;
}
string Item::getname(){
return this->name_;
}
string Item::getmanufacturer(){
return manufacturer_;
}
int Item::getID(){
return ID_;
}
int Item::getprice(){
return price_;
}
void Item::printDetails(){
coutname_
coutmanufacturer_
coutID_
coutprice_
}
Item::~Item(){
cout
}
image text in transcribed
image text in transcribed
The following diagram illustrates the classes you will implement in this lab and their relationships. Private Item (-) name Type: string (-) manufacturer Type: string (-) ID Type: int (-) price Type: int (+) Parameterized constructor (+) Setters (+) Getters (+) print Details : void Public Phone (-) cameraResolution Type: int (-) OsType Type: string (+) Parameterized Constructor (+) Getters (+) Setters Laptop (-) RAMSize Type: int (-) Processor Type Type: string (+) Parameterized Constructor (+) Getters (+) Setters QUESTION 1: The implementation of class Item is uploaded to the elearning. Copy Item.h and Item.cpp to your project. QUESTION 2: 1. Implement class Phone, which inherits from class Item (use public inheritance). 2. Function printDetails of the base class should be overridden to print the additional information about the resolution of the camera and the OS type. QUESTION 3: Implement class Laptop, which inherits from class Item (use protected inheritance). 1. Function getName in the base class should be overridden to return the name + "(Laptop)". 2. Function printDetails of the base class should be overridden to print the additional information about the size of the RAM and processor type. QUESTION 4: Implement a driver program to test your code. 1. create an object of type Phone, assign the appropriate values for each data member, don't forget to assign values to parent class data members. 2. create an object of type Laptop, assign the appropriate values for each data member, don't forget to assign values to parent class data members. 3. print the details of both objects. 4. change the name for both objects to be "New name". Justify any error occurs. 5. print the name for both objects

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

Intelligent Databases Object Oriented Deductive Hypermedia Technologies

Authors: Kamran Parsaye, Mark Chignell, Setrag Khoshafian, Harry Wong

1st Edition

0471503452, 978-0471503453

More Books

Students also viewed these Databases questions