Sunday, November 17, 2013

Request: Retail Price Program

Retail Price Program

This program was requested by a user, you can make a bigger program by using this logic.

Code:



// http://www.cppfuzz.com (Ahmad Mukhtar)
/*
  ______ .______   .______    _______  __    __   ________   ________  
 /      ||   _  \  |   _  \  |   ____||  |  |  | |       /  |       /  
|  ,----'|  |_)  | |  |_)  | |  |__   |  |  |  | `---/  /   `---/  /   
|  |     |   ___/  |   ___/  |   __|  |  |  |  |    /  /       /  /    
|  `----.|  |      |  |      |  |     |  `--'  |   /  /----.  /  /----.
 \______|| _|      | _|      |__|      \______/   /________| /________|
                                                                       
*/
#include <iostream>
using namespace std;
void main()

{
 double product1 = 2.98;
 double product2 = 4.50;
 double product3 = 9.98;
 double product4 = 4.49;
 double product5 = 6.87;
 char answer1, answer2, answer3, answer4, answer5;
 double qop1,qop2,qop3,qop4,qop5, total, total1=0, total2=0, total3=0, total4=0, total5=0;
 cout << "Price of Product number 1 is: $" << product1 << endl;
 cout << "Price of Product number 2 is: $" << product2 << endl;
 cout << "Price of Product number 3 is: $" << product3 << endl;
 cout << "Price of Product number 4 is: $" << product4 << endl;
 cout << "Price of Product number 5 is: $" << product5 << endl;
 cout << "Do you want to buy Product 1 ? (Y/N)";
 cin >> answer1;
 switch (answer1)
 {
 case 'y': case 'Y':
  {
   cout << "How much quanity of Product 1 you want ?" << endl;
   cin >> qop1;
   total1 = qop1 * product1;
  }
  break;

 default:
  {
   cout << "You are not buying Product 1" << endl;
  }
 }
 cout << "Do you want to buy Product 2 ? (Y/N)";
 cin >> answer2;
 switch (answer2)
 {
 case 'y': case 'Y':
  {
   cout << "How much quanity of Product 2 you want ?" << endl;
   cin >> qop2;
   total2 = qop2 * product2;
  }
  break;

 default:
  {
   cout << "You are not buying Product 2" << endl;
  }
 }
 cout << "Do you want to buy Product 3 ? (Y/N)";
 cin >> answer3;
 switch (answer3)
 {
 case 'y': case 'Y':
  {
   cout << "How much quanity of Product 3 you want ?" << endl;
   cin >> qop3;
   total3 = qop3 * product3;
  }
  break;

 default:
  {
   cout << "You are not buying Product 3" << endl;
  }
 }
 cout << "Do you want to buy Product 4 ? (Y/N)";
 cin >> answer4;
 switch (answer4)
 {
 case 'y': case 'Y':
  {
   cout << "How much quanity of Product 4 you want ?" << endl;
   cin >> qop4;
   total4 = qop4 * product4;
  }
  break;

 default:
  {
   cout << "You are not buying Product 4" << endl;
  }
 }
 cout << "Do you want to buy Product 5 ? (Y/N)";
 cin >> answer5;
 switch (answer5)
 {
 case 'y': case 'Y':
  {
   cout << "How much quanity of Product 5 you want ?" << endl;
   cin >> qop5;
   total5 = qop5 * product5;
  }
  break;

 default:
  {
   cout << "You are not buying Product 5" << endl;
  }
 }
 total = total1 + total2 + total3 + total4 + total5;
 cout << "Total Retail Price Is: $" << total << endl;
}

Widgets

 

Copyright @ 2014 CPP Fuzz.