Untitled

 avatar
unknown
plain_text
2 days ago
528 B
1
Indexable
class Mobil {
String merk;
int tahunProduksi;
int nomerPlat;

  Mobil(this.merk, this.nomerPlat, this.tahunProduksi);

  void brandCar() {
    print('Mobil $merk yang bernomor plat $nomerPlat merupakan satu satunya mobil yang diproduksi pada tahun $tahunProduksi');
  }
}
  void main() {
    Mobil mobil1 = Mobil('Toyota', 4870 , 2020);
    Mobil mobil2 = Mobil('Honda', 4871 , 2021);
    Mobil mobil3 = Mobil('Suzuki', 4872 , 2022);

    mobil1.brandCar();
    mobil2.brandCar();
    mobil3.brandCar();
  }
Leave a Comment