Quick actions

cmd+k|ctrl+k

Navigation

Languages

Tugas PPBO Week-1

Snippet info

Language

Java

Visibility

public

Author

daffarahman

Created

2025-09-18T07:16:47.478479Z

Updated

2025-09-19T15:54:21.179936Z

// Nama : Muhammad Daffa Rahman
// NIM  : L0124062
// Program : Rakit PC Simulator

import component.Component;
import component.OS;
import computer.PC;

// Rakit PC Simulator
public class PPBO_01_L0124062 {
    public static void main(String[] args) {
        
        // Komponen PC
        OS windows95 = new OS("Windows 95", "4.0");
        Component softram98 = new Component("Softram98 2GB Virtual RAM");
        Component ambastonSSD = new Component("Ambaston 64 GB SSD");
        Component m3ultra = new Component("Apple M3 Ultra");
        
        // PC-nya
        PC macintosh = new PC("Macintosh PC");
        
        // install 1 komponen di PC
        macintosh.installComponent(windows95);
        
        // Cek apakah PC sudah bisa dihidupkan (ini belum)
        System.out.println("Can " + macintosh.name + " be turned on? " + macintosh.isPowerable());
        
        // Install 3 komponen lagi di PC
        macintosh.installComponent(softram98);
        macintosh.installComponent(ambastonSSD);
        macintosh.installComponent(m3ultra);
        
        // Cek lagi apakah PC sudah bisa dihidupkan (ini suda)
        System.out.println("Can " + macintosh.name + " be turned on? " + macintosh.isPowerable());
        
        // Mencoba menghidupkan PC 2 kali
        macintosh.turnOn();
        macintosh.turnOn();
        
        // Shutdown PC
        macintosh.turnOff();
    }
}

INFO