I really need help with this JAVA lab. I'm not calling the methods correctly and cant figure out how to correctly calculate the total cost of gas in my last method. In the attached image is the instructions and what my output should look like. I have to use at least 4 helper methods. At the bottom is my existing code. Thank you

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter3: Using Methods, Classes, And Objects
Section: Chapter Questions
Problem 12PE
icon
Related questions
Question

I really need help with this JAVA lab. I'm not calling the methods correctly and cant figure out how to correctly calculate the total cost of gas in my last method. In the attached image is the instructions and what my output should look like. I have to use at least 4 helper methods. At the bottom is my existing code. Thank you

MY CODE:
import java.util.Scanner;
public class esudde00Lab1 {

   private static final int CLASS_MEETINGS = 46;
   public static void main(String[] args) {
       // TODO Auto-generated method stub
       Scanner kb = new Scanner(System.in);
       String name = "Meagan Smith";
       double MILES_FROM_CAMPUS = 8.5;
       int MINUTES_FROM_CAMPUS = 12;
       int CAR_MPG = 22;
      
       //user input
       System.out.println("What is the cost of gas per gallon?");
       double gasPerGallon = kb.nextDouble();

       System.out.println("Student mileage report \t\t\t Meagan Smith");
       System.out.println("=======================================================");
       System.out.println("Miles per trip /t/t/t/t" + MILES_FROM_CAMPUS*2 );
       System.out.println("Miles this semester \t\t\t", getMiles(miles));
       System.out.println("Cost of gas per gallon \t\t $" + gasPerGallon);
       System.out.println("Miles per gallon \t\t\t\t" + CAR_MPG);
       System.out.println("Cost of gas per trip \t\t\t $" + (gasPerGallon/CAR_MPG)*(MILES_FROM_CAMPUS*2));
       System.out.println("Number of trips \t\t\t\t" + CLASS_MEETINGS);
       System.out.println("Hours/min in the car/t/t",getHours(hours)+" hrs",getMinutes(minutes)+"min");
       }// end of main method
   public static int getHours(int MIN_FROM_CAMPUS )
   {
       int hours = (MIN_FROM_CAMPUS * 2 * CLASS_MEETINGS)/60;
       return hours;
   }//end of getHours
   public static int getMinutes (int MIN_FROM_CAMPUS)
   {
       int minutes = (MIN_FROM_CAMPUS * 2 * CLASS_MEETINGS);
       return minutes;
   }// end of getMinutes
   public static int getMiles(int MILES_FROM_CAMPUS)
   {
       int miles = MILES_FROM_CAMPUS * 2 * CLASS_MEETINGS;
       return miles;
   }//end of get miles
   public static double getGasTotal(double gasPerGallon)
   {
       int CAR_MPG = 22;
       double gasTotal =
   }
  
  

}//end of program

Create a class called <yourloginID>Lab1.java (Eclipse will add the .java)
Write a program that will set up variables for each of the following:
Your first name and last name
How many miles you live from campus (guess if you're not sure)
How long (in minutes) it takes you to get to school on one typical day (one-way)
How many miles you get in your car per gallon of gas (guess if you're not sure)
Have your user enter
The cost of gas per gallon.
NOTE: DO NOT HAVE YOUR USER ENTER ANY ADDITIONAL STUFF
Also define a constant variable for the number of class meeting sessions we have this semester (46).
Use helper methods as appropriate - 4 at a minimum. Using these variables, calculate
the number of hours (in hours and minutes) you will spend in your car driving to and from class this sem
total mileage this semester
the amount of money you will spend for gas
Display all of this information as follows
Student mileage report
<Your name>
Miles per trip
Mileage this semester
Cost of gas per gallon
Miles per gallon
Cost of gas per trip
Number of trips
Hours/min in the car
XXX
XXX
$x.xx
XX.X
XX.XX
XXX
XX hours
XX min
$xx.XX
Cost of gas for the semester
Transcribed Image Text:Create a class called <yourloginID>Lab1.java (Eclipse will add the .java) Write a program that will set up variables for each of the following: Your first name and last name How many miles you live from campus (guess if you're not sure) How long (in minutes) it takes you to get to school on one typical day (one-way) How many miles you get in your car per gallon of gas (guess if you're not sure) Have your user enter The cost of gas per gallon. NOTE: DO NOT HAVE YOUR USER ENTER ANY ADDITIONAL STUFF Also define a constant variable for the number of class meeting sessions we have this semester (46). Use helper methods as appropriate - 4 at a minimum. Using these variables, calculate the number of hours (in hours and minutes) you will spend in your car driving to and from class this sem total mileage this semester the amount of money you will spend for gas Display all of this information as follows Student mileage report <Your name> Miles per trip Mileage this semester Cost of gas per gallon Miles per gallon Cost of gas per trip Number of trips Hours/min in the car XXX XXX $x.xx XX.X XX.XX XXX XX hours XX min $xx.XX Cost of gas for the semester
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Returning value from Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT