Answered step by step
Verified Expert Solution
Question
1 Approved Answer
What is the programs output if the input is: 1 3 Berries 6 shirt Jump to level 1 Type the program's output - 1 Jump
What is the programs output if the input is:
Berries
shirt
Jump to level
Type the program's output Jump to level
Type the program's output
main.cpp:
#include "Products.h
using namespace std;
int main
Products allProducts;
allProducts.InputProducts;
allProducts.PrintAfterDiscount;
return ;
Product.h:
#ifndef PRODUCTH
#define PRODUCTH
#include
class Product
public:
void SetPriceAndNameint productPrice, std::string productName;
int GetPrice const;
std::string GetName const;
private:
int price;
std::string name;
;
#endif
Product.cpp:
#include "Product.h
using namespace std;
void Product::SetPriceAndNameint productPrice, string productName
price productPrice;
name productName;
int Product::GetPrice const
return price;
string Product::GetName const
return name;
Products.h:
#ifndef PRODUCTSH
#define PRODUCTSH
#include
#include "Product.h
class Products
public:
void InputProducts;
void PrintAfterDiscountint discountPrice;
private:
std::vector productList;
;
#endif
Products.cpp:
#include
#include "Products.h
using namespace std;
void Products::InputProducts
Product currProduct;
int currPrice;
string currName;
cin currPrice;
while currPrice
cin currName;
currProduct.SetPriceAndNamecurrPrice currName;
productList.pushbackcurrProduct;
cin currPrice;
void Products::PrintAfterDiscountint discountPrice
unsigned int i;
int currDiscountPrice;
for i ; i productList.size; i
currDiscountPrice productList.atiGetPrice discountPrice;
cout $ currDiscountPrice productList.atiGetName endl;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started