Advertisement
Morogn93

Untitled

May 3rd, 2015
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.91 KB | None | 0 0
  1. class Car3 {
  2.     int doors;
  3.     String carColor;
  4.     String wheelsColor;
  5.     String tiresColor;
  6.     String brand;
  7.     String model;
  8.      
  9.     //Konstruktor
  10.     Car3(String carBrand, String carModel, int doorsNumber,
  11.             String color, String wheels, String tires) {
  12.          
  13.         // przypisujemy parametry, które podaliśmy jako argumenty konstruktora
  14.         brand = carBrand;
  15.         model = carModel;
  16.         doors = doorsNumber;
  17.         carColor = color;
  18.         wheelsColor = wheels;
  19.         tiresColor = tires;
  20.     }
  21.      
  22.     void printInfo() {
  23.         String info = "";
  24.         info = info + brand+" ";
  25.         info = info + model+", ";
  26.         info = info+ "kolor: " + carColor + ", " ;
  27.         info = info+ "drzwi: " + doors + ", " ;
  28.         info = info+ "felgi: " + wheelsColor +", ";
  29.         info = info+ "opony: " + tiresColor;
  30.  
  31.         System.out.println(info);
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement