64 570
Assignments Done
99,2%
Successfully Done
In September 2018

Answer to Question #44122 in C++ for Saran

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.
Expert's answer
#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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions