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
#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!";
}
}
Comments
Leave a comment