Q:

How to use OOP, constructors, and objects to pass variables to methods and main method

I have a program in which I am calculating and printing out gas mileage information. The assignment I'm working on wants me to (well I think it wants me to) use OOP, constructor, and object to pass variables from a constructor to my whole program. It makes no sense to me at all.
Here are the exact assignment instructions:
https://drive.google.com/file/d/1D1FZKHrU4duu1UyWusPvsjVum33B8kdt/view?usp=sharing
I've tried making my original variables in the main method private static variables and placed them right below my class header. This worked, but I think the instructions want my constructor to include variables somehow. It just doesn't make any sense to me at all. I don't get constructors or objects whatsoever and how to use them in this application, and its frustrating the hell out of me. 
CarV3, the program the instructions reference in terms of what I'm supposed to object orient, looked like this:
public class CarV3 {
    public static int calcDistance(int sMiles1, int eMiles1){
        return eMiles1 - sMiles1;
    }

    public static double calcMPG(int dist1, double gals1){
        return dist1 / gals1;
    }

    public static void main(String[]Args) {
        int sMiles1 = 43305;
        int eMiles1 = 43422;
        int dist1;
        double gals1 = 7.8;
        double MPG1;
        String carType1 = "14 Acura MDX";

        CarV3 car1 = new CarV3();

        dist1 = car1.calcDistance(sMiles1, eMiles1);
        MPG1 = car1.calcMPG(dist1, gals1);

        System.out.printf("%52s%n%s%16s%14s%13s%12s%14s%n%s%n", "Gas Mileage Calculations", "Type of Car", "Start Miles", "End Miles", "Distance", "Gallons", "Miles/Gal",
"================================================================================");
        System.out.printf("%s%15d%14d%13d%12.1f%14.1f", carType1, sMiles1, 
        eMiles1, dist1, gals1, MPG1);
    }
}

That code worked before.
The instructions ask to calculate GPM and other data later, so my program turns into something more like this in CarV5:
public class CarV5 {
    private static int sMiles1 = 43266;
    private static int eMiles1 = 43422;
    private static int dist1;
    private static double gals1 = 7.8;
    private static double MPG1;
    private static double pricePerGallon1 = 2.98;
    private static double GPM1;
    private static double totalCost1;
    private static String carType1 = "14 Acura MDX";

    CarV5() {
    }

    public int calcDistance(int sMiles1, int eMiles1){
        return eMiles1 - sMiles1;
    }

    public static double calcMPG(int dist1, double gals1){
        return dist1 / gals1;
    }

    public static double calcGPM(int dist1, double gals1) {
        return gals1 / dist1;
    }

    public static double totalCost(double pricePerGallon1, double gals) {
        return pricePerGallon1 * gals;
    }

    public static void main(String[]Args) {
        CarV5 car1 = new CarV5();

        dist1 = car1.calcDistance(sMiles1, eMiles1);
        MPG1 = car1.calcMPG(dist1, gals1);
        GPM1 = car1.calcGPM(dist1, gals1);
        totalCost1 = car1.totalCost(pricePerGallon1, gals1);

        System.out.printf("%70s%n%s%16s%14s%13s%12s%10s%9s%14s%13s%n%s%n", "Gas Mileage Calculations", "Type of Car", "Start Miles", "End Miles", "Distance", "Gallons", "Price", "Cost", "Miles/Gal", "Gal/Mile", "================================================================================================================");
        System.out.printf("%s%15d%14d%13d%12.1f%10.2f%9.2f%14.1f%13.3f", carType1, sMiles1, eMiles1, dist1, gals1, pricePerGallon1, totalCost1, MPG1, GPM1);
    }
}

Although this code works, I'm almost positive it isn't what the instructions asked me to do. I honestly don't understand what the instructions want me to do. The program you see there does print the expected result, which is all of the car data. However, in the instructions, I am told to use some kind of constructor with values in it. If you notice in the second version I have this "CarV5() {}", which I don't understand as to what it does.
The expected output is correct in my second version of the program, CarV5, as mentioned before. A table prints out calculated values of distance, gallons, etc.
My approach is what's wrong.
I'm sorry for the super long post, but my friends who are also taking this course think I'm past the point of being taught, and if I'm being honest, maybe I am too. I just really want to figure out how to do this.

A:

Ok, I am not sure what the assignment is as it is not accessible but I think they want you to create a Class with fields which are gonna be set in constructor during object creation. Let me show a brief example:
package tst;

public class CarTest {

    public static void main(String[] args) {
        // creating new instance of the Car and at once setting all its fields in constructor
        // now as I see the assignment, this line corresponds to 
        // CarV5 car1 = new CarV5(carType1, endMiles1, startMiles1, gallonsUsed1, pricePerGallon1);
        Car car = new Car(43266, 43422, 7.8);

        //calculating and printing the result w/o providing values but using instance fields
        System.out.println(car.calcDistance());

    }

    // the Car class itself, you can put it in different file
    public static class Car {

        // note that fields are NOT static, i.e. they belong to an INSTANCE of the class, not the class itself
        private int sMiles1;
        private int eMiles1;
        private double gals1;

        //
        public Car(int sMiles1, int eMiles1, double gals1) {
            this.sMiles1 = sMiles1;
            this.eMiles1 = eMiles1;
            this.gals1 = gals1;
        }

        // example of your methods
        public int calcDistance(){
            return this.eMiles1 - this.sMiles1;
        }

        // other methods you need

    }

}

Let me know if that helps :)
PS: I think what confuses you are static vs instance methods, try to refresh this part of the course or use some other source (=google :) )

