Posts

Showing posts from November, 2018

Tugas PBO - ImageViewer 1.0

Image
Nama: Donny Fitrado NRP: 05111740000171 Kelas: PBO A Source code: 1. ImageViewer import java.awt.*; import java.awt.event.*; import java.awt.image.*; import javax.swing.*; import java.io.File; /** * ImageViewer is the main class of the image viewer application. It builds and * displays the application GUI and initialises all other components. * * To start the application, create an object of this class. * * @author Donny Fitrado * @version 26-11-18 */ public class ImageViewer { // static fields: private static final String VERSION = "Version 1.0"; private static JFileChooser fileChooser = new JFileChooser(System.getProperty("user.dir")); // fields: private JFrame frame; private ImagePanel imagePanel; private JLabel filenameLabel; private JLabel statusLabel; private OFImage currentImage; /** * Create an ImageViewer show it on screen. */ pu...

Tugas PBO - Foxes and Rabbits

Nama: Donny Fitrado NRP: 05111740000171 Kelas: PBO A Source code: 1. Rabbit import java.util.List; import java.util.Random; /** * A simple model of a rabbit. * Rabbits age, move, breed, and die. * * @author Donny Fitrado * @version 19-11-18 */ public class Rabbit { // Characteristics shared by all rabbits (static fields). // The age at which a rabbit can start to breed. private static final int BREEDING_AGE = 5; // The age to which a rabbit can live. private static final int MAX_AGE = 40; // The likelihood of a rabbit breeding. private static final double BREEDING_PROBABILITY = 0.15; // The maximum number of births. private static final int MAX_LITTER_SIZE = 4; // A shared random number generator to control breeding. private static final Random rand = Randomizer.getRandom(); // Individual characteristics (instance fields). // The rabbit's age. private int age; // ...

Tugas PBO - Database Akademik

Image
Nama: Donny Fitrado NRP: 05111740000171 Kelas: PBO A Di tugas ini, saya akan membuat sebuah database akademik. Source code: 1. Database /** * Donny Fitrado * 17/11/2018 */ import java.util.ArrayList; public class Database { private ArrayList<Mahasiswa> mahasiswa; private ArrayList<Dosen> dosen; private ArrayList<Pegawai> pegawai; public Database() { mahasiswa = new ArrayList<Mahasiswa>(); dosen = new ArrayList<Dosen>(); pegawai = new ArrayList<Pegawai>(); } public void addMahasiswa(Mahasiswa Themhs) { mahasiswa.add(Themhs); } public void addDosen(Dosen dsn) { dosen.add(dsn); } public void addPegawai(Pegawai pgw) { pegawai.add(pgw); } public void listMahasiswa() { for(Mahasiswa mhs : mahasiswa) { mhs.prnt(); System.out.println(); } } public void ...

Tugas PWeb - Database disertai Penggunaan AJAX

Image
Nama: Donny Fitrado NRP: 05111740000171 Kelas: Pemrograman Web C Source code: 1. config.php <?php $db = mysqli_connect('localhost', 'root', '','pendaftaran_siswa'); if(!$db ){ die("Gagal terhubung dengan database: " . mysqli_connect_error()); } ?> 2. index.php <!DOCTYPE html> <html> <head> <link rel="stylesheet" type="text/css" href="css.css"> </head> <body> <div> <header> <h2 align="center">Pendaftaran Siswa Baru</h2> <h1 align="center">SMA Kr. Cita Hati</h1> </header> <h3 align="center">Menu</h3> <p align="center"><button type="button" onclick="showsiswa()">Student List</button></p> <p align="center...