Maybe a different browser? I am viewing this in google chrome, all that should show is a jpg of a text document. I will type the instructions here then.
The Bone Jour Day Dog Care Center charges clients a daily rate that is based on both the size
of the dog and the number of days per month in a client's contract.
The Following table shows the daily rates:
1-10 days a month 11 or more days a month
Under 10 Pounds 12$ 10$
10 pounds-under 35 16$ 13$
pounds
35 pounds and over 19$ 17$
I have to prompt the user to enter a dog's weight and number of days per month needing care, then calculate and display the daily rate and the total for the month (days times the daily rate)
It also says I need to use Compound conditionals, and I have forgotten if those are just functions. I am being taught a little bit different so I fear I may not understand fully if I receive help. What I do not understand is how to start one of the functions, could I try
Just start peeling away at the problem. What functions do you need? Certainly one to get the information about the contract:
1 2
// Prompt the user for the dog's weight and days per month of daycare needed.
void getContractInfo(int &daysPerMonth, int &dogWeight);
You'll also have to figure out the daily rate. That depends on the weight and days per month. Although the numbers in the table are all integers, it's probably a good idea to return a double in case the rate changes to, say, $10.50. double getDailyRate(int daysPerMonth, int dogWeight);
With these functions, what does the main program look like? Do you need any other functions? What do they look like? Sketch out the program like this and then fill in the details.
///Bone Jour Dog care Center///
/// 1/4/2016 PWD ///
#include <iostream>
using namespace std;
int main()
{
// Define variables
int dogWeight=0, numDays=0, dRate=0, mRate;
// Welcome
cout << "Hello welcome to Bone Jour Dog Care center!" << endl;
// Ask for weight
cout << "How much does your dog weigh?: " << endl;
cin >> dogWeight;
// Check if weight is valid
while(dogWeight <= 0)
{
// Display error
cout << "Invalid weight, weight must be greater than zero." <<endl;
// Re-input
cin >> dogWeight;
}
// Ask for days
cout << "How many days will your dog be staying?: " << endl;
cin >> numDays;
// Check if days are valid
while(numDays <= 0)
{
// Display error
cout << "Invalid input, days must be greater than zero." <<endl;
// Re-input
cin >> numDays;
}
//Change rate based on number of days and weight
if (numDays <= 10)
{
if(dogWeight < 10)
{
dRate = 12;
}
else if(dogWeight < 35)
{
dRate = 16;
}
else
{
dRate = 19;
}
}
else
{
if(dogWeight < 10)
{
dRate = 10;
}
else if(dogWeight < 35)
{
dRate = 13;
}
else
{
dRate = 17;
}
}
cout << "Your daily rate is: "<<dRate<<endl;
mRate = dRate * numDays;
cout<<"Your total stay will cost: "<<mRate<<endl;