Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question 1 (35 marks) This question is based on contents covered in Chapter 10 o

ID: 3873244 • Letter: Q

Question

Question 1 (35 marks) This question is based on contents covered in Chapter 10 of text. The objectives of the questions are to: access if students have understood the basic concepts of object-oriented class write the class specification, constructor and methods write test driver to test the written methods e Examine the following class diagram, additional information and answer the questions that follow screenType: char screenSize: int resolution: string price: double standard: bool TV(char = 'L', int = 50, string="HD", double = 600, bool true setorder void display:void getPrice ) :double etStandard):bool; Method Remarks TV (char-'Lint 50, string "DConstructor with default values. The double-600, bool- true) positional arguments are screenType screenSize, resolution, price and standard. Set the data members accordingly. [Note: Screen type 'O stands for OLED and L stands for LCD. Screensize is can be "HD and "UHD" Assessor for data members, price and getPrice ) : double getstandard:bool: setorder :void Prompt the user to enter the screenType, screenSize and resolution. The default price S600 is for standard size (50 inch), screen type (LCD) and resolution(HD). If there is any change to standard values, set standard to false. If the screen Type is O add S300. If the screenSize is greater than 50 inch, add S20 for LCD TVs and $40 for OLED TVs for each additional inch. If the resulution is UHD, add $200 for LCD TVs and S400 for OLED TVs. Update the price Uses cout to display the respective data members. If standard is true, displays Standard TV".If standard is false display:void

Explanation / Answer

#include <iostream>

using namespace std;

class TV {
private:
char screenType;
int screenSize   
string resolution;
double price;
bool standard;

public:
TV: screenType('L'), screenSize(50),resolution("HD"), price(600),standard(true)
{}

void setOrder() {
cout<<"Please enter screen type"<<endl;
cin>>screenType;
cout<<"Please enter screen size"<<endl;
cin>>screenSize;
cout<<"Please enter screen resolution"<<endl;
cin>>resolution;
if(screenType!='L' || screenSize!=50 || resolution!="HD")
standard=false;
if(screenType=='O')
price+=300;
if(screenSize>50)
{
if(screenType=='L')
price+=(screenSize-50)*20;
else if(screenType=='O')
price+=(screenSize-50)*40;
}
if(resolution=="UHD")
{
if(screenType=='L')
price+=200;
else if(screenType=='O')
price+=400;
}
}


}

void display() {
if(standard)
cout<<"Statndard TV Specifications";
else
cout<<"Customised TV Specifications";
cout<<screenType<<endl;
cout<<screenSize<<endl;   
cout<<resolution<<endl;
cout<<price<<endl;
cout<<standard<<endl;

}
double getPrice() {
return price;
}
bool getStandard() {
return standard;
}
void displayMenu() {
int selection;
cout<<" TV Sales System Menu";
cout<<" ======================";
cout<<" 1. Order TV";
cout<<" 2. Display Oour Orders";
cout<<" 3. Display the orders that differ from the standard values(type or size or resolution";
cout<<" 4. Display the TV with highest price";
cout<<" 5. Exit";
cout<<" Enter Choice(1-5): ";
cin>>selection;
return selection;
}
};

// Main function for the program
int main() {
TV * my_TV;
my_TV = new TV[5];
my_TV[0] = new TV(0);
my_TV[1] = new TV(1);
my_TV[2] = new TV(2);
my_TV[3] = new TV(3);
my_TV[4] = new TV(4);



return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote