DEV Community

Vignesh . M
Vignesh . M

Posted on • Edited on

TASK:

CREATE A CLASE = BIKE ;
GET THE DISTENCE = getDistanceCovere;
GET THE FUELQUANTITY = petrolQuantity;
FIND THE MILLAGE OF THE BIKE = getmillage;

PROGRAM:

  public class Bike {  

  public int getmillage(int getDistanceCovere,int petrolQuantity){

  System.out.println("Distance : "+ getDistanceCovere + "KM");

  System.out.println("FUELQUANTITY : "+ petrolQuantity + "L");

  return getDistanceCovere/petrolQuantity;

    }

    public static void main(String[] args) {

    Bike bike = new Bike();

    int millage = bike.getmillage(45,3);

    System.out.println("getmillage : " + millage +"Per Liter");

    }


    }
Enter fullscreen mode Exit fullscreen mode

OUTPUT:
Distance : 45KM
FUELQUANTITY : 3L
getmillage : 15Per Liter

Image description

Top comments (0)