generate functionWed, 11 Jan 2023

Create 4 C++ classes as follows: - Rooms class includes the following a.) constructor, with which we set the basic unit of measurement of the product (e.g. "kg" or "l"), its quantity and specific price (price per unit of measurement) b.) double getTotal() method, which returns the price of the product (specific price multiplied by quantity). This method should be virtual so that the TrappistaCheese class can define it on top! c.) an empty virtual destructor - Basket class includes the following: a.) Stores a vector with Termek pointers b.) add() method, with which I can add new products to the basket c.) total() method, which displays the total yield (the sum of the prices of all products) d.) Don't forget the destructor either, to avoid memory leaks - An additional Milk and Peach and Trappist Cheese classes, based on their implementation, the program must give the specified output. - The getTotal() method of the TrappistaSajt class also includes the discount when calculating the subtotal For example: Test Result Basket s; s.add(new Berries(5.2, 1800, "kg")); // 5.2 kg peaches, HUF 480 / kg s.add(new Milk(3.0, 2.8, 800, "l")); // 3 liters 2.8 sazalek, HUF 800 / liter s.add(new Trappist Cheese(0.5, 2205, "kg", 0.2)); // 0.5kg, 2205 HUF / kg, but 20% discount; Basket dimensions: 9360 + 2400 + 882 = 12642

#include <iostream> #include <vector> #include <string> class Termek { private: double m_db; double m_argon; double m_fizetendo; std::string m_mertekegyseg; public: Termek(double db, double argon, std::string mertekegyseg) : m_db(db), m_argon(argon), m_mertekegyseg(mertekegyseg) { m_fizetendo = m_argon * m_db; } double getTotal() { return m_fizetendo; } virtual ~Termek() {} }; class TrappistaSajt : public Termek { private: double m_kedvezmeny; public: TrappistaSajt(double db, double argon, std::string mertekegyseg, double kedvezmeny) : Termek(db, argon, mer

Questions about programming?Chat with your personal AI assistant