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, 23.06.2019 01:30
How do you set up a slide show to play continuously, advancing through all the slides without requiring your interaction? a. click set up slide show, and then select the loop continuously until ‘esc' and show without narration options. b. click set up slide show, and then select the loop continuously until ‘esc' and use timings, if present options. c. click set up slide show, and then select the show presenter view and use timings, if present options. d. click set up slide show, and then select the show without animation and browsed at a kiosk (full screen) options.
Answers: 3
question
Computers and Technology, 23.06.2019 09:00
Which company provides a crowdsourcing platform for corporate research and development? a: mtruk b: wiki answers c: mediawiki d: innocentive
Answers: 2
question
Computers and Technology, 24.06.2019 07:30
Consider the folloeing website url: what does the "http: //" represent? a. protocal identifier. b. ftp. c. domain name d. resource name
Answers: 2
question
Computers and Technology, 24.06.2019 11:00
The program below has been generalized to read a user's input value for hourlywage. run the program. notice the user's input value of 10 is used. modify that input value, and run again. generalize the program to get user input values for workhoursperweek and workweeksperyear (change those variables' initializations to 0). run the program. monthsperyear will never change, so define that variable as final. use the standard for naming final variables. ex: final int max_length
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, 18.05.2021 23:00
question
Mathematics, 18.05.2021 23:00
Questions on the website: 13722367