What's new

Help Help po sa c++

potatoXfries

Eternal Poster
Joined
Feb 9, 2018
Posts
687
Reaction
603
Points
434
pa help po sa machine problem na 'to hihi
Pepito Manongsong is a carpenter who wants an application to compute the price of any desk a customer orders,
based on the following: desk length and width in inches, type of wood, and number of drawers. The price is computed
as follows:
• The minimum charge for all desks is $200.
• • If the surface (length * width) is over 750 square inches, add $50.
• If the wood is mahogany, add $150; for oak, add $125. No charge is added for pine.
• • For every drawer in the desk, there is an additional $30 charge


Type of Wood:
[1] – Mahogany (add $150)
[2] – Oak (add $125)
[3] – Pine
Enter choice:

Surface size:
Length:
Width:
Do you want drawer? [Y-Yes, N-No]
Enter no. of drawers:

nasimulan ko na po siya e medyo nalito po sa if and else


Screenshot_2021-11-10-21-30-25-13_a927ed2714ba3b9021f681846134c26f.jpg
 

Attachments

tama naman.. tuloy mo lang..


C++:
int length;
int width; // Lagay karin for 'width'

// Pinalitan ko lang onti ung variable names
int minCharge = 200;
int mahoganyPrice = 150;
int oakPrice = 50;
int drawerPrice = 30;
int totalDrawerPrice = 0;
int overCharge = 50;   
int addWoodCharge = 0;
int numberOfDrawers;

if (option == '1')
    cout << "You have chosen [1]\n";
    addWoodCharge = mahoganyPrice;
else if(option == '2')
    cout << You have chosen [2]\n";
    addWoodCharge = oakPrice;
else if(option == '3')
    cout << "You have chosen [3]\n"; // pine
 
// Sa labas dapat to ng "if option==1, 2, 3"
cout << "[Please enter surface size]\n";

cout << "Length: \n";
cin >> length;

cout << "Size: \n";
cin >> width;

cout << "Do you want drawer? [Y-YES, N-No]\n";
cout << "Enter no. of drawers: \n";
cin >> numberOfDrawers;

// Calculate yung charge
// Not sure if greater than 750 or greater than or equal to 750
if ((length*width) >= 750)
    totalCharge = minCharge + addWoodCharge + overCharge;
else
    totalCharge = minCharge + addWoodCharge;

totalCharge = totalCharge + (drawerPrice * numberOfDrawers);

cout << "Total charge: " << totalCharge;
 
tama naman.. tuloy mo lang..


C++:
int length;
int width; // Lagay karin for 'width'

// Pinalitan ko lang onti ung variable names
int minCharge = 200;
int mahoganyPrice = 150;
int oakPrice = 50;
int drawerPrice = 30;
int totalDrawerPrice = 0;
int overCharge = 50; 
int addWoodCharge = 0;
int numberOfDrawers;

if (option == '1')
    cout << "You have chosen [1]\n";
    addWoodCharge = mahoganyPrice;
else if(option == '2')
    cout << You have chosen [2]\n";
    addWoodCharge = oakPrice;
else if(option == '3')
    cout << "You have chosen [3]\n"; // pine
 
// Sa labas dapat to ng "if option==1, 2, 3"
cout << "[Please enter surface size]\n";

cout << "Length: \n";
cin >> length;

cout << "Size: \n";
cin >> width;

cout << "Do you want drawer? [Y-YES, N-No]\n";
cout << "Enter no. of drawers: \n";
cin >> numberOfDrawers;

// Calculate yung charge
// Not sure if greater than 750 or greater than or equal to 750
if ((length*width) >= 750)
    totalCharge = minCharge + addWoodCharge + overCharge;
else
    totalCharge = minCharge + addWoodCharge;

totalCharge = totalCharge + (drawerPrice * numberOfDrawers);

cout << "Total charge: " << totalCharge;
salaaaaaamat paps review ko na rin
 
Last edited:

Similar threads

Back
Top