Answer to Question #238743 in C++ for Bryce

Question #238743

Your horse has to have 1 ounce of probiotic supplement a day. You can buy it per


pound, as a 10 lb pail at a 10% discount, or as a 20 lb pail at a 15% discount. Your


goal is to produce formatted output showing the daily cost for each buying


option. You should ask the user to enter the price per lb.



1
Expert's answer
2021-09-18T02:57:15-0400
#include<iostream>
using namespace std;
int main()
{
	int A,option;
	float P;
	cout<<"Enter the price of the supplement: ";
	cin>>A;
	cout<<"\nEnter the buying option \n1. 10 lb pail\n2. 20 lb pail"<<endl;
	cin>>option;
	
	if(option==1)
	{
		P=A-(0.1*A);
		cout<<"The daily cost is: "<<P<<" pounds";
	}
	else if(option==2)
	{
	    P=A-(0.15*A);
		cout<<"The daily cost is: "<<P<<" pounds";	
	}
	else
	{
	 cout<<"Invalid option!";
	}
}

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!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS