Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package kwiecien.dziewiaty;
- public class Car {
- String name;
- String color;
- String engine;
- int speed; // predkosc
- public Car() {
- }
- public Car(String name, String color, String engine, int speed) {
- this.name = name;
- this.color = color;
- this.engine = engine;
- this.speed = speed;
- }
- public void printCar() {
- System.out.println("Nazwa: " + name + ", kolor: " + color + ", silnik: " + engine);
- }
- public void switchCarName(String name) {
- this.name = name;
- }
- public void driveFast() throws InterruptedException {
- int actualSpeed = 0;
- for (int i = 0; actualSpeed < speed; i++) {
- Thread.sleep(5000);
- actualSpeed += 100;
- System.out.println("Obecna prędkość wynosi: " + actualSpeed + " km/h");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement