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 17:20
[a] create a class called “cycle” which has two instance integer variables as properties, “numberofwheels” and “weight.” create a constructor with two parameters, using the same variable names in the parameter list. assign each variable to numberofwheels” and “weight” respectively. write a separate application to test the class and display its properties. note: do not change the names of the instance variables or the variables listed in the constructor’s parameter list. [b] edit your class cycle by adding a default constructor which will assign the default values of 100 to represent the numberofwheels, and 1000 to represent the weight, by invoking a call to the other constructor. modify your application created in [a] to test the class.
Answers: 3
question
Computers and Technology, 22.06.2019 19:30
Singing in the rain: this first part of the film shows the early history of motion picture. how accurate do you think the portrayal of the early motion picture industry is? why? is historical accuracy important in films and theater productions? explain.
Answers: 1
question
Computers and Technology, 23.06.2019 13:00
Which one of the following voltages should never be measured directly with a vom? a. 1200 v b. 500 v c. 800 v d. 100v
Answers: 2
question
Computers and Technology, 23.06.2019 13:50
Explain how email technologies enable the exchange of messages between users. find out the typical parts of an email address and explain each part.
Answers: 1
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, 27.04.2021 06:20
question
Mathematics, 27.04.2021 06:20
question
Mathematics, 27.04.2021 06:20
question
Mathematics, 27.04.2021 06:20
Questions on the website: 13722363