Answer to Question #238741 in C++ for Bryce

Question #238741

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



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