Question: Please help fix my code so options 1,2,3,4,5 can run and have correct output.I have attached additional information also. Test driver (i) Declares an array

Please help fix my code so options 1,2,3,4,5 can run and have correct output.I have attached additional informationPlease help fix my code so options 1,2,3,4,5 can run and have also.

Test driver (i) Declares an array of 5 TV objects. (ii) Calls the function, displayMenu() in a loop and invokes the respective methods of TV class corresponding to the selected choice. (iii) Option 1: invoke the method, setOrder() and performs boundary check for the array of TV objects (iv) Option 2: uses a loop to invoke the display method of array of TV objects (v) Option 3: traverses the array of TV objects and displays the orders that differ from the standard values (type or size or resolution). (vi) Option 4: traverses the array of TV objects to find the TV with the highest price. (vii) Option 5: displays the message,Thank you for using the program... and exit the loop.

TV Header file

#ifndef H_TV

#define H_TV

#include

#include

using namespace std;

class TV

{

friend ostream& operator

friend istream& operator >> (istream&, TV &);

private:

char screenType;

int screenSize;

string resolution;

double price;

bool standard;

int choice;

public:

TV();

~TV();

double getPrice() const;

bool getStandard() const;

void setOrder(char, int, string);

void setPrice(double p);

void setStandard(bool std);

void display();

bool operator == (const TV&)const;

};

#endif

TV CPP file

#include

#include

#include "TV.h"

using namespace std;

TV::TV()

{

screenType = 'L';

screenSize = 50;

resolution = "HD";

price = 600;

standard = true;

}

double TV::getPrice() const

{

return price;

}

bool TV::getStandard() const

{

return standard;

}

void TV::setPrice(double p)

{

price=p;

}

void TV::setStandard(bool std)

{

standard=std;

}

TV::~TV()

{}

void TV::setOrder(char ty, int sz, string re)

{

screenType = ty;

screenSize = sz;

resolution = re;

cout

cin >> screenType;

cout

cin >> screenSize;

cout

cin >> resolution;

if (screenType == 'O')

{

price = price + 300;

standard = false;

}

if (resolution == "UHD")

{

if (screenType == 'L')

{

price = price + 200;

}

else if (screenType == 'O')

{

price = price + 400;

}

standard = false;

}

if (screenSize > 50)

if (screenType == 'L')

{

price = price + ((screenSize - 50)* 20);

}

else if (screenType == 'O')

{

price = price+((screenSize - 50) * 40);

}

standard = false;

}

void TV::display()

{

cout

", Price = "

if (standard == true)

cout

else if (standard==false)

cout

}

ostream& operator

{

osObject

"; Standard = "

return osObject;

}

istream& operator >> (istream& isObject, TV&TV1)

{

isObject >> TV1.screenType >> TV1.screenSize >> TV1.resolution >> TV1.price >> TV1.standard;

return isObject;

}

bool TV::operator == (const TV&TV1)const

{

if ((screenType == TV1.screenType) && (screenSize == TV1.screenSize) && (resolution == TV1.resolution) &&

(price == TV1.price) && (standard == TV1.standard))

return true;

else

return false;

}

#include

#include

#include"TV.h"

using namespace std;

int displaymenu()

{

int choice = 0;

cout

cout

cout

cout

cout

cout

cout

cout

cin >> choice;

return choice;

}

int main()

{

TV TV1();

TV TVcustom[5];

char screenType='L';

int screenSize=50;

string resolution="HD";

int choice;

while (true) {

choice = displaymenu();

switch (choice)

{

case 1:

for (int i = 0; i

{

TVcustom[i].setOrder(screenType, screenSize, resolution);

}

break;

case 2:

for (int i = 0; i

{

TVcustom[i].display();

}

break;

case 3:

for (int i = 0; i

{

if (TVcustom[i].getStandard == false)

cout

}

break;

default: break;

}

}

system("PAUSE");

return 0;

}

TV screenType: char screenSize: int resolution: string price: double standard: bool Tv (char- ,,, int= 50, string="HD", double = 600, bool = true) setorder void display ) :void getPrice () :double etStandard ():bool; Additional Information: Method Remarks Constructor with default values. The 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 standard Prompt the user to enter the screenType, screenSize and resolution. The default price $600 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 screenType is 'O add $300. If the screenSize is greater than 50 inch, add $20 for LCD TVs and $40 for OLED TVs for each additional inch. If the resulution is UHD, add $200 for LCD TVs and $400 for OLED TVs. Update the price accordingl Uses cout to display the respective data members. If standard is true, displays "Standard TV' If standard is false TV (char - 'L', int 50, string-"HD", double = 600, bool = true) getPrice ():double getstandard ) :bool; setorder )void display :void

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!