/***********************************************************
wordproblem-cereal.ch
Word Problem
Use this program to help students conceptualize word
problems, specifically: Charisse is buyig two different
types of cereals from the bulk bins at the store. Granola
costs &2.29 per pound, and muesli costs $3.75 per pound.
She has $7.00. How many pounds of granola can she buy if
she buys 1.5 pounds of muesli?
************************************************************
Copyright 2014 SoftIntegration Inc.
http://www.softintegration.com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
***********************************************************/
//initialize variables
double Granola_Cost = 2.29;
double Muesli_Cost = 3.75;
double Total = 7.00;
double Granola_Amount = 0.5;
double Muesli_Amount = 1.5;
//solve for desired amount
while (Granola_Cost * Granola_Amount + Muesli_Cost * Muesli_Amount <= Total)
{
Granola_Amount+= .5;
}
//display answer
printf("%.2lf pounds", Granola_Amount);