Posts

Showing posts from November, 2019

inheritance

Nama: Bayu Surya Bawono NRP: 05111840000114 Class: Item public class Item { private String title; private int playingtime; private boolean gotit; private String comment; public Item(String title, int playingtime) //constructor { this.title=title; this.playingtime=playingtime; this.gotit=false; this.comment = ""; } public void setComment(String comment)//method untuk memasukkan comment item { this.comment = comment; } public String getComment() //method untuk return comment item { return this.comment; } public void setGotIt(boolean gotit) //method untuk memasukkan ketersediaan item { this.gotit = gotit; } public boolean getGotIt() //method untuk return ketersediaan item { return this.gotit; } public void Print() //method untuk mencetak item { System.out.println("Title: " + title + "( " + playingtime ...

Image_viewer & Login

Image
Nama: Bayu Surya Bawono NRP: 05111840000114 Class: Image import java.awt.*; import java.awt.event.*; import java.awt.image.*; import javax.swing.*; import java.io.File; /** * hana * 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 Michael Kolling and David J Barnes * @version 1.0 */ public class Image { // 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 Panel imagePanel; private JLabel filenameLabel; private JLabel statusLabel; private OFImage currentImage; /** * Create an ImageViewer show it on screen. */ public Image() ...

Fortune Teller & Java Applet

Image
Nama: Bayu Surya Bawono NRP: 0511840000114 Class: Applet import java.awt.*; public class Applet extends java.applet.Applet{ public void paint(Graphics g){ Font f = new Font("SansSerif", Font.BOLD, 20); g.setFont(f); g.setColor(Color.BLUE); int xPusat = this.getSize().width/2; int yPusat = this.getSize().height/2; String s = "Selamat Belajar Java Applet"; FontMetrics fm = this.getFontMetrics(f); int posisiX = xPusat - (fm.stringWidth(s)/2); g.drawString("Selamat Belajar java Applet", posisiX, yPusat); } } Class: Fortune teller import javafx.application.Application; import javafx.application.Platform; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.VBox; import javafx.scene.text.Font; import javafx.s...

Game-Kartu

Image
Nama: Bayu Surya Bawono NRP: 05111840000114 Class: Main import java.io.IOException; import java.util.Random; import java.util.Scanner; public class main { private static Scanner scanner; public static void main(String[]args) throws IOException { int ulang = 5; int start = 1; System.out.println("Selamat datang di game tebak kartu"); System.out.println("Dimana 0 = Tidak ada kartu ,1 = A , 11 = J , 12= Q , 13= K "); System.out.println("Dan kamu punya 5 kesempatan untuk menukar kartu"); System.out.println("Selamat Bermain!!"); Pemain [] playerCom = new Pemain[2]; Pemain [] player1 = new Pemain[2]; for (int i = 0; i < playerCom.length; i++) { playerCom[i] = new Pemain(); } for (int i = 0; i < playerCom.length; i++) { player1[i] = new Pemain(); } Random tandRandom = new Random(); ...

Java Point Of Sale

Image
Nama: Bayu Surya Bawono NRP: 05111840000114 import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.*; import javafx.scene.layout.*; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.control.Label; import javafx.scene.text.Font; import javafx.scene.text.Text; import javafx.stage.Stage; import javafx.scene.Group; import javafx.geometry.Insets; import javafx.geometry.Pos; import javax.swing.*; import java.lang.Integer; import java.lang.String; public class qwerty extends Application { String kodeKasir; String kodeBarang; String namaBarang; int hargaBarang; int jumlahBarang; int totalHarga; @Override public void start(Stage primaryStage) { primaryStage.setTitle("Input Barang"); Text tkasir = new Text("Kasir: "); Text tkode = new Text("Kode Barang: "); Text tnama = new Text("Nama B...