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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 23:30, riah133
Creating "smart interfaces" in all sectors of industry, government, and the public arena is one of the fastest growing hct areas. these interfaces model, interpret, and analyze such human characteristics as speech, gesture, and vision. the field of biometrics, in which humans authenticate themselves to machines, is an area of considerable interest to hct practitioners. fingerprint scans are one of the most frequently used biometric options, and this article, biometric student identification: practical solutions for accountability & security in schools, makes a case for the implementation of fingerprint scans in schools. critique the article, and answer the following questions: according to the author, what are the main benefits of adopting fingerprint scans in schools for student identification? according to the author, what are the main drawbacks of adopting fingerprint scans in schools for student identification? do you agree with the author's assessment of the pl
Answers: 2
image
Computers and Technology, 22.06.2019 23:30, jhonpiper
For her science class, elaine is creating a presentation on weather in the united states. she wants to make the presentation beautiful and interesting by drawing simple cloud or wave shapes. which is the best way for elaine to draw these shapes?
Answers: 1
image
Computers and Technology, 22.06.2019 23:30, Molly666
What does 21 pilots middle aged name as a band 15 years prior to them naming their band 21 pilots?
Answers: 1
image
Computers and Technology, 23.06.2019 03:50, nakeytrag
Iam a bacterium. i cause stomach cramps and diarrhea. i am caused by eating rotten foodssuch as chicken, fish, or eggs. sometimes turtles carry my bacteria. what am i?
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 in other subjects: