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
12 changes: 12 additions & 0 deletions Car/src/Body.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
public class Body {
public String Tape,Color;

public Body(String tape, String color) {
Tape = tape;
Color = color;
}
public void BodyDisplay(){
System.out.println("Тип кузова "+ Tape + "Колір " + Color);
}

}
11 changes: 11 additions & 0 deletions Car/src/Car.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
public class Car {
String Mark;
Body body;
Helm helm;
Wheels wheels;


public void CarMarkDisplay(){
System.out.println("Марка машини " + Mark);
}
}
33 changes: 33 additions & 0 deletions Car/src/Helm.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
public class Helm {
private int Diameter;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

camel case

private String Material;

public int getDiameter() {
return Diameter;
}

public void setDiameter(int diameter) {
Diameter = diameter;
}

public String getColor() {
return Material;
}

public void setMaterial(String material) {
Material = material;

}

public Helm(int diameter, String material) {
Diameter = diameter;
Material = material;
}

public void HelmDisplay(){
System.out.println("Диаметр Руля "+ Diameter +" Матеріал з якого віготовлений руль " + Material);
}



}
16 changes: 16 additions & 0 deletions Car/src/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
public class Main {
public static void main(String[] args) {

Car car = new Car();
car.body = new Body(" Бус "," Білий ");
car.Mark = " Mercedes ";
car.helm = new Helm(20," Шкіра ");
car.wheels = new Wheels(17," Bridgestone ",2);
car.CarMarkDisplay();
car.body.BodyDisplay();
car.helm.HelmDisplay();
car.wheels.WheelsDisplay();

}
}

4 changes: 4 additions & 0 deletions Car/src/PumpWheel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
public interface PumpWheel {
void pump();
}

76 changes: 76 additions & 0 deletions Car/src/Wheels.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import java.sql.SQLOutput;

class Wheels implements PumpWheel {
private int Radius;
private String Brand;
private double Pressure;


public int getRadius() {
return Radius;
}

public void setRadius(int radius) {
Radius = radius;
}

public String getBrand() {
return Brand;
}

public void setBrand(String brand) {
Brand = brand;
}

public double getPressure() {
return Pressure;
}

public void setPressure(double pressure) {
Pressure = pressure;
}

public Wheels(int radius, String brand, double pressure) {
Radius = radius;
Brand = brand;
Pressure = pressure;
}

@Override
public String toString() {
if (Radius == 15)
return "Radius " + Radius + " Michelin";
else
return "Radius " + Radius + Brand;
}

@Override
public void pump() {
if (Radius <= 15 & Pressure == 2.2) {
System.out.println(" Тиск в шинах в нормі ");
}
else {
while (Radius <= 15 & Pressure <= 2.2) {
Pressure = Pressure + 0.1;
System.out.println(" Підкачка колес ");
}
}
if (Radius <= 20 & Pressure == 2.8) {
System.out.println(" Тиск в шинах в нормі ");
}
else {
while (Radius <= 20 & Pressure <= 2.8) {
Pressure = Pressure + 0.1;
System.out.println(" Підкачка колес ");
}
}

}

public void WheelsDisplay () {
System.out.println("Радіус колеса " + Radius + " Виробник " + Brand + " Тиск в шинах " + Pressure);
}

}