Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

help me with the code, its error #include using namespace std; enum class Cargo{ bag, skis, suitcase }; ostream& operator class Seat{ private: int row;

image text in transcribed

help me with the code, its error

#include

using namespace std;

enum class Cargo{ bag, skis, suitcase };

ostream& operator

class Seat{ private: int row; char seat; public: Seat(int roow=0, char seaat='?'):row(roow), seat(seaat){} friend bool operator==(Seat& seat1, Seat& seat2){ return (seat1.row==seat2.row && seat1.seat==seat2.seat); } friend ostream& operator

ostream& operator

//TASK 3

class Payload{ private: Payload *next; public: Payload(); virtual ~Payload(); void set_next(Payload *payload); Payload* get_next(); void printAll(); virtual int get_weight(){} virtual void print(){} };

Payload::Payload(){ next = nullptr; }

Payload::~Payload(){ }

void Payload::set_next(Payload *payload){ next = payload; }

//3.5

Payload* Payload::get_next(){ return this->next; }

//3.6 void Payload::printAll(){ cout

//4

class Freight : public Payload { private: Cargo cargo; int id; int weight; public: Freight(Cargo carg, int ident, int wei) : cargo(carg), id(ident), weight(wei){} virtual ~Freight(){} int get_weight(){return weight;} virtual void print(){ cout

//task 5 class Passenger : public Payload{ private: string name; Seat seat; bool veggie; public: Passenger(string nama, bool veg) : name(nama), veggie(veg){} virtual ~Passenger(){} string get_name(){return name;} int get_weight(){ int pasweight=75000; return pasweight;} void set_seat(Seat seaat){seat=seaat;} void invert(){veggie=false;} //harus dipastikan lg virtual void print(){ cout

//task 6 class Economy : public Passenger{ public: Economy(string nama, bool veg=false) : Passenger(nama, veg){} virtual void print(){ cout

//task 7 class Flight{ private: string code; float weight; Payload *payloads; public: class IncompleteData : public exception{ }; Flight(string cod):code(cod){ weight = 0; payloads = nullptr; } void load(Freight *freight){ do{ weight += payloads->get_weight(); payloads = freight->get_next();} while(payloads!=nullptr); } void board(Passenger *pass, Seat seat){ pass->set_seat(seat); weight = weight + pass->get_weight(); } void print(){ cout print(); } };

//task 8 int main(void){ Flight f = Flight("LH 123"); Freight *s = new Freight(Cargo::skis, 456, 6800); f.load(s);

Freight *b = new Freight(Cargo::bag, 789, 18000); f.load(b);

Seat S = Seat (23, 'A');

f.board(new Passenger("Wally", true), S); f.board(new Passenger("Dilbert", false), Seat(27, 'D'));

f.print();

return 0; }

Aufgabeko Matr- Matr. No. Einfhrende Erluterungen/introductory Explanations Fornon F ot o delle anche Wertungeraron von dungen Paytond van het weer P a ssenger Spitzen et der ersten und deren F atin Liste noch Zuladungen & Pht the UML mode l for Payloads nght and or Pasengene wand Ben W Seats. Each might has Payloads payloads ception - + Ft + board load() + print Payload bet new get next printAO getwight + pro IncompleteData - now Passenger Freight id -name Task 5 Task 4 - veggie - weight + Seat) + Passenger + Freight) + operator + get_name() + get weight operatorcco Hinweis + print) + get weight() Oberladene konstruktoren, + set seat() Destruktoren, (Rckgabe-) Typen, + invert() Parameter sowie vererbte Attribute + print() cargo und Methoden sind in der Abbildung > der (Unter-) Klassen jeweils Cargo weggelassen./ Hint Economy First + bag Overloaded constructors, destructors, + skis (return) types, parameters as well as / Economy) + FirstClass( + suitcase inhented attributes and methods are + print) omitted in the (sub)class figure parts. print() not to program Task 6 Task print methods are Omitted in the sub Aufbau einer Liste von Zuladungen eines Flugs/Structure of list of payloads of a flight Flight Payload . Payload Payload Payload CH next next payload Beispiel Programmlauf/Example Program Run flight: LH 123 with total weight payload: 174.8 kg economy class passenger: Dilbert, seat: 27 D economy class passenger: Wally (vegetarian), seat: 23 A freight bag: id = 789, weight = 18000 g freight skis: id = 456, weight = 6800 g Beispiel Sitzpltze/Example In a BBBBB S8888 C++ WS 2018/2019 Aufgabeko Matr- Matr. No. Einfhrende Erluterungen/introductory Explanations Fornon F ot o delle anche Wertungeraron von dungen Paytond van het weer P a ssenger Spitzen et der ersten und deren F atin Liste noch Zuladungen & Pht the UML mode l for Payloads nght and or Pasengene wand Ben W Seats. Each might has Payloads payloads ception - + Ft + board load() + print Payload bet new get next printAO getwight + pro IncompleteData - now Passenger Freight id -name Task 5 Task 4 - veggie - weight + Seat) + Passenger + Freight) + operator + get_name() + get weight operatorcco Hinweis + print) + get weight() Oberladene konstruktoren, + set seat() Destruktoren, (Rckgabe-) Typen, + invert() Parameter sowie vererbte Attribute + print() cargo und Methoden sind in der Abbildung > der (Unter-) Klassen jeweils Cargo weggelassen./ Hint Economy First + bag Overloaded constructors, destructors, + skis (return) types, parameters as well as / Economy) + FirstClass( + suitcase inhented attributes and methods are + print) omitted in the (sub)class figure parts. print() not to program Task 6 Task print methods are Omitted in the sub Aufbau einer Liste von Zuladungen eines Flugs/Structure of list of payloads of a flight Flight Payload . Payload Payload Payload CH next next payload Beispiel Programmlauf/Example Program Run flight: LH 123 with total weight payload: 174.8 kg economy class passenger: Dilbert, seat: 27 D economy class passenger: Wally (vegetarian), seat: 23 A freight bag: id = 789, weight = 18000 g freight skis: id = 456, weight = 6800 g Beispiel Sitzpltze/Example In a BBBBB S8888 C++ WS 2018/2019

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_2

Step: 3

blur-text-image_3

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

Fundamentals Of Database System

Authors: Elmasri Ramez And Navathe Shamkant

7th Edition

978-9332582705

More Books

Students also viewed these Databases questions