Question: in java pls- Three programs have three problems with them: One of the programs below has a logic error in it meaning that, while it
in java pls-
-
Three programs have three problems with them:
-
One of the programs below has a logic error in it meaning that, while it compiles and runs, it
doesnt produce the correct output. You must find the error and fix it.
-
One of the programs below doesnt compile, so you cant even run it! Based on what we just told
you, you must figure out why fix the error, save the file, and re-run the code.
-
One of the programs compiles and runs fine but has a typo in the output.
-

================ Program Labic.java ================================= // Program Lab1c.java // Demonstrate the use of the Scanner class to read numeric data. import java.util.Scanner; public class Labic { // Calculates fuel efficiency based on values entered by the user. public static void main (String[] args) { int miles; double gallons, mpg; Scanner scan = new Scanner (System.in); System.out.print ("Enter the number of miles: "); miles - scan.nextInt (); System.out.print ("Enter the gallons of fuel used: "); gallons = scan.nextDouble(); mpg = miles * gallons; System.out.println ("Miles Per Gallon: + mpg); }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
