Question #44122
create a program that will do the following:
1. Ask the user to enter names of 5 products
2. The buying price of the 5 products
3. The selling price of the 5 products
4. The expenses of each type of a product(percentage of the buying price)

Task- Calculate the gross profit and net profit and project it.
1
Expert's answer
2014-07-12T05:15:40-0400
#include <iostream>typedef struct {    std::string name;    double buiyingPrice;    double sellingPrice;    double percentage;    void calculatePercentage () {        percentage = buiyingPrice/ sellingPrice;    }} Product;int main() {    Product *array = new Product();    std::cout << "Enter information for 5 products" << std::endl;    for ( int i = 0; i < 5; i++ ) {        std::cout << "Enter name: ";        std::cin >> array[i].name;         std::cout << "Enter buiyingPrice:";         std::cin >> array[i].buiyingPrice;          std::cout << "Enter sellingPrice:";          std::cin >> array[i].sellingPrice;          array[i].calculatePercentage();          std::cout << "Percentage is " << array[i] << "%" << std::endl;    }    return 0;}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!
LATEST TUTORIALS
APPROVED BY CLIENTS