Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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 << setprecision(2);
cout << "Enter the amount of fertilizer, in pounds, "
<<"in one bag: ";
cin >> bagSize;
cout << endl;
cout << "Enter the cost of the "<< bagSize
<<" pound fertilizer bag: ";
cin >> cost;
cout << endl;
cout << "Enter the area, in square feet, that can be "
<< "fertilized by one bag: ";
cin >> area;
cout << endl;
cout << "The cost of the fertilizer per pound is: $"
<< bagSize / cost << endl;
cout << "The cost of fertilizing per square foot is: $"
<< area / cost << endl;
return 0;
}
Format your output with setprecision(2) to ensure the proper number of decimals for testing!
Task #01: Cost per pound and per square foot correctly output
Test Feedback:
Status: FAILED!
Check: 1
Test: Cost per pound and per square foot correctly output test 1
Reason: Unable to find '['0.36','0.04']' in the program's output.
Enter the amount of fertilizer, in pounds, in one bag:
Enter the cost of the 33.00 pound fertilizer bag:
Enter the area, in square feet, that can be fertilized by one bag:
The cost of the fertilizer per pound is: $2.75
The cost of fertilizing per square foot is: $25.00
.
Error : AssertionError - Unable to find a number close enough to 0.36(+/-0.00) in the program's output.
Timestamp: 2024-05-2202:36:35.189281
Status: FAILED!
Check: 2
Test: Cost per pound and per square foot correctly output test 2
Reason: Unable to find '['0.80','0.07']' in the program's output.
Enter the amount of fertilizer, in pounds, in one bag:
Enter the cost of the 10.00 pound fertilizer bag:
Enter the area, in square feet, that can be fertilized by one bag:
The cost of the fertilizer per pound is: $1.25
The cost of fertilizing per square foot is: $15.01
.
Error : AssertionError - Unable to find aThe 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.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2017 Skopje Macedonia September 18 22 2017 Proceedings Part 3 Lnai 10536

Authors: Yasemin Altun ,Kamalika Das ,Taneli Mielikainen ,Donato Malerba ,Jerzy Stefanowski ,Jesse Read ,Marinka Zitnik ,Michelangelo Ceci ,Saso Dzeroski

1st Edition

ISBN: 3319712721, 978-3319712727

More Books

Students also viewed these Databases questions

Question

4. How is culture a contested site?

Answered: 1 week ago