gpt-4-0314· OpenAI
WildChat-4.8M (AI2)
Класс заказ фотографий. Поля: номер заказа, фамилия заказчика, вид (пленка или файл),…
- User
Класс заказ фотографий. Поля: номер заказа, фамилия заказчика, вид (пленка или файл), размер фотографий, количество фотографий, срочность, стоимость одной фотографии (с учетом носителя, размера и срочности), общая стоимость заказа.напиши код на C++ и используй std в начале а не в каждой строке
- Assistant
#include <iostream> #include <string> class PhotoOrder { public: PhotoOrder(int order_num, std::string customer_lastname, std::string type, std::string size, int quantity, bool urgency, double unit_price) : order_num_(order_num), customer_lastname_(customer_lastname), type_(type), size_(size), quantity_(quantity), urgency_(urgency), unit_price_(unit_price) { total_price_ = unit_price_ * quantity_; } // Getters int getOrderNum() const { return order_num_; } std::string getCustomerLastname() const { return customer_lastname_; } std::string getType() const { return type_; } std::string getSize() const { return size_; } int getQuantity() const { return quantity_; } bool getUrgency() const { return urgency_; } double getUnitPrice() const { return unit_price_; } double getTotalPrice() const { return total_price_; } // Setters void setOrderNum(int order_num) { order_num_ = order_num; } void setCustomerLastname(std::string customer_lastname) { customer_lastname_ = customer_lastname; } void setType(std::string type) { type_ = type; } void setSize(std::string size) { size_ = size; } void setQuantity(int quantity) { quantity_ = quantity; } void setUrgency(bool urgency) { urgency_ = urgency; } void setUnitPrice(double unit_price) { unit_price_ = unit_price; } private: int order_num_; std::string customer_lastname_; std::string type_; std::string size_; int quantity_; bool urgency_; double unit_price_; double total_price_; }; int main() { PhotoOrder order(1, "Smith", "file", "10x15", 5, true, 2.5); std::cout << "Order number: " << order.getOrderNum() << std::endl; std::cout << "Customer lastname: " << order.getCustomerLastname() << std::endl; std::cout << "Type: " << order.getType() << std::endl; std::cout << "Size: " << order.getSize() << std::endl; std::cout << "Quantity: " << order.getQuantity() << std::endl; std::cout << "Urgency: " << order.getUrgency() << std::endl; std::cout << "Unit price: " << order.getUnitPrice() << std::endl; std::cout << "Total price: " << order.getTotalPrice() << std::endl; return 0; }