This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Nama: Ratu Klarisa | |
| //Nim: 251410010 | |
| //Kelas: SI2A | |
| // Abstract class | |
| abstract class MediaPlayer { | |
| void info() { | |
| print('Media Player aktif'); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Nama:Ratu Klarisa | |
| //Nim: 251410010 | |
| //Kelas:SI2A | |
| import 'dart:math'; | |
| class MathUtils { | |
| // Faktorial | |
| static int faktorial(int n) { | |
| if (n <= 1) return 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Nama: Ratu Klarisa | |
| //Nim: 251410010 | |
| //Kelas: SI2A | |
| class Komputer { | |
| void hitung() { | |
| print('Komputer menghitung data'); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Nama: Ratu klarisa | |
| //Nim: 251410010 | |
| //Kelas: SI2A | |
| // Abstract class | |
| abstract class Pekerja { | |
| void bekerja(); // abstract method | |
| void info() { | |
| print('Saya adalah seorang pekerja'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Nama: Ratu Klarisa | |
| //Nim: 251410010 | |
| //Kelas: SI2A | |
| abstract class Bentuk { | |
| double hitungLuas(); | |
| double hitungKeliling(); | |
| void info() { | |
| print('Luas: ${hitungLuas()}, Keliling: ${hitungKeliling()}'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Nama: Ratu Klarisa | |
| //Nim: 251410010 | |
| //Kelas: SI2A | |
| abstract class MetodePembayaran { | |
| void bayar(double jumlah); | |
| } | |
| class KartuKredit implements MetodePembayaran { | |
| @override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Nama: Ratu Klarisa | |
| //Nim: 251410010 | |
| //Kelas: SI2A | |
| class MathUtils { | |
| static double pi = 3.14; | |
| static int add(int x, int y) { | |
| return x + y; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Nama: Ratu Klarisa | |
| //Nim: 251410010 | |
| //kelas: SI2A | |
| abstract class Flyable { | |
| void terbang(); | |
| } | |
| class Bird implements Flyable { | |
| @override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Nama: Ratu Klarisa | |
| // Nim: 251410010 | |
| // Kelas: SI2A | |
| abstract class AlatMusik { | |
| void mainkan(); // Abstract method | |
| void info() { | |
| // Concrete method | |
| print('Ini adalah alat musik'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Nama: Ratu Klarisa | |
| //Nim: 251410010 | |
| //Kelas: SI2A | |
| abstract class Kendaraan { | |
| String? merk; // Field | |
| void start(); // Method abstract | |
| void stop() { // Method concrete |
NewerOlder