Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Main
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.company;

public class Main {

public static void main(String[] args) {
Mashina myMashina = new Mashina("BLUE", "CHERY", 9, 4, 1800);
myMashina.drive(200);
myMashina.Ref(4);
myMashina.distan1();
}
}
33 changes: 33 additions & 0 deletions Mashina
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.company;

public class Mashina {
public String Marka;
public double rozhid;
public double objem;
public double probig;
public double distan;
public double km;



public Mashina(String colir, String marka, double rozhid, double objem, double probig) {
this.Colir = colir;
this.Marka = marka;
this.rozhid = rozhid;
this.objem = objem;
this.probig = probig;
}
void drive(int km){
distan=100/this.rozhid*this.objem;
System.out.println("Відстань:" + distan + "," + "Загальний пробіг:" + (probig+distan));}
public void Ref (int objem) {
if (distan >= km){
System.out.println("Бензин закінчився");
}
}

public void distan1 () {
System.out.println(this.Colir + " " + this.Marka + ", пробіг: " + (probig+distan));
}
}