1. Write a program that prompts the user to enter the weight of a person in kilograms and outputs the equivalent weight in pounds. Output both the weights rounded to two decimal places. (Note that 1 kilogram = 2.2 pounds.) Format your output with two decimal places.
2. During each summer, John and Jessica grow vegetables in their back yard and buy seeds and fertilizer from a local nursery. The nursery carries different types of vegetable fertilizers in various bag sizes. When buying a particular fertilizer, they want to know the price of the fertilizer per pound and the cost of fertilizing per square foot. The following program prompts the user to enter the size of the fertilizer bag, in pounds, the cost of the bag, and the area, in square feet, that can be covered by the bag. The program should output the desired result. However, the program contains logic errors. Find and correct the logic errors so that the program works properly.
//Logic errors.
#include #include using namespace std;int main(){double cost;double area;double bagSize;cout < fixed="">< showpoint=""><>cout < "enter="" the="" amount="" of="" fertilizer,="" in="" pounds,="">< "in="" one="" bag:="">cin >> bagSize;cout <>cout < "enter="" the="" cost="" of="" the="" "=""><>< "="" pound="" fertilizer="" bag:="">cin >> cost;cout <>cout < "enter="" the="" area,="" in="" square="" feet,="" that="" can="" be="">< "fertilized="" by="" one="" bag:="">cin >> area;cout <>cout < "the="" cost="" of="" the="" fertilizer="" per="" pound="" is:="">< bagsize="" cost=""><>cout < "the="" cost="" of="" fertilizing="" per="" square="" foot="" is:="">< area="" cost=""><>return 0;}
#include using namespace std;int main(){double cost;double area;double bagSize;cout < fixed="">< showpoint=""><>cout < "enter="" the="" amount="" of="" fertilizer,="" in="" pounds,="">< "in="" one="" bag:="">cin >> bagSize;cout <>cout < "enter="" the="" cost="" of="" the="" "=""><>< "="" pound="" fertilizer="" bag:="">cin >> cost;cout <>cout < "enter="" the="" area,="" in="" square="" feet,="" that="" can="" be="">< "fertilized="" by="" one="" bag:="">cin >> area;cout <>cout < "the="" cost="" of="" the="" fertilizer="" per="" pound="" is:="">< bagsize="" cost=""><>cout < "the="" cost="" of="" fertilizing="" per="" square="" foot="" is:="">< area="" cost=""><>return 0;}
using namespace std;
int main()
{
double cost;
double area;
double bagSize;
cout < fixed="">< showpoint=""><>
cout < "enter="" the="" amount="" of="" fertilizer,="" in="" pounds,="">
< "in="" one="" bag:="">
cin >> bagSize;
cout <>
cout < "enter="" the="" cost="" of="" the="" "=""><>
< "="" pound="" fertilizer="" bag:="">
cin >> cost;
cout < "enter="" the="" area,="" in="" square="" feet,="" that="" can="" be="">
< "fertilized="" by="" one="" bag:="">
cin >> area;
cout < "the="" cost="" of="" the="" fertilizer="" per="" pound="" is:="">
< bagsize="" cost=""><>
cout < "the="" cost="" of="" fertilizing="" per="" square="" foot="" is:="">
< area="" cost=""><>
return 0;
}
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here