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
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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fc2239705-c051-40af-901a-0ccb2a28fb27%2F422cbb0e-0d5d-449b-bcde-c1b9343ef947%2Fv0xa8fc_processed.jpeg&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)