Advertisement
ahmfarisi

Dart PBO Part 5

Sep 18th, 2024 (edited)
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 0.38 KB | None | 0 0
  1. class PersegiPanjang{
  2.   int panjang;
  3.   int lebar;
  4.  
  5.   PersegiPanjang(this.panjang,this.lebar);
  6.  
  7.   int hitungLuas(){
  8.     return panjang * lebar;
  9.   }
  10.  
  11.   int hitungKeliling(){
  12.     return 2* ( lebar + panjang);    
  13.   }
  14.  
  15. }
  16.  
  17. void main(){
  18.   var OPP = PersegiPanjang(5,3);
  19.  
  20.   print('Luas     = ${OPP.hitungLuas()}');
  21.   print('Keliling = ${OPP.hitungKeliling()}');
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement