subject

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.
import java. util.*;
public class ch3_prexercise4
{
static scanner console = new scanner(system. in);
public static void main(string[] args)
{
double cost; double area;
double bagsize;
system. out. print("enter the amount of fertilizer, " + "in pounds, in one bag: ");
bagsize = console. nextdouble(); system. out. println();
system. out. print("enter the cost of the " + bagsize + " pound fertilizer bag: ");
cost = console. nextdouble(); system. out. println();
system. out. print("enter the area, in square feet, that " + "can be fertilized by one bag: ");
area = console. nextdouble(); system. out. println();
system. out. printf("the cost of the fertilizer per pound is: " + "$%.2f%n", bagsize / cost);
system. out. printf("the cost of fertilizing per square " + "foot is: $%.4f%n", area / cost);
}
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 12:40
In a response of approximately 50 words, explain why it would be essential for the successful a/v technician to participate in additional coursework, presentations and seminars offered by equipment manufacturers as well as annual conferences attended by colleagues in the industry.
Answers: 1
question
Computers and Technology, 22.06.2019 13:00
Why the bear has a slunky tail determine the meaning of the word slunk in the story
Answers: 1
question
Computers and Technology, 22.06.2019 22:50
Assume the existence of a bankaccount class. define a derived class, savingsaccount that contains two instance variables: the first a double, named interestrate, and the second an integer named interesttype. the value of the interesttype variable can be 1 for simple interest and 2 for compound interest. there is also a constructor that accepts two parameters: a double that is used to initialize the interestrate variable, and a string that you may assume will contain either "simple", or "compound", and which should be used to initialize the interesttype variable appropriately. there should also be a pair of functions getinterestrate and getinteresttype that return the values of the corresponding data members (as double and int respectively).
Answers: 2
question
Computers and Technology, 23.06.2019 01:30
For a typical middle-income family, what is the estimated cost of raising a child to the age of 18? $145,500 $245,340 $304,340 $455,500
Answers: 2
You know the right answer?
During each summer john and jessica grow vegetables in their back yard and buy seeds and fertilizer...
Questions
question
Mathematics, 12.11.2020 22:10
question
Mathematics, 12.11.2020 22:10