Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 55 additions & 59 deletions Nasabah/src/main/java/com/mycompany/nasabah/Nasabah.java
Original file line number Diff line number Diff line change
@@ -1,70 +1,66 @@

package com.mycompany.nasabah;

import java.util.Scanner;
/**
*
* @author Hamdan
*/

/** @author Hamdan */
public class Nasabah {
String nama;
int norek;
int saldo;
String nama;
int norek;
int saldo;

public Nasabah (String x,int y, int z) {
this.nama=x;
this.norek=y;
this.saldo=z;
}
public void ceksaldo(){
System.out.println("Nama pemilik rekening :"+nama );
System.out.println("Nomor rekening :"+norek );
System.out.println("Saldo rekening saat ini :"+saldo );

}
public int tariktunai(int a){
saldo=saldo-a;
return saldo;
}
public int terimauang(int a){
saldo=saldo+a;
return saldo;
}
public Nasabah(String x, int y, int z) {
this.nama = x;
this.norek = y;
this.saldo = z;
}

public static void main(String args[]){
Nasabah Nasabah1 = new Nasabah("Hamdan",001,2000000);
Nasabah Nasabah2 = new Nasabah("vera",002,3000000);
Scanner input1=new Scanner(System.in);
Scanner input2=new Scanner(System.in);
public void ceksaldo() {
System.out.println("Nama pemilik rekening :" + nama);
System.out.println("Nomor rekening :" + norek);
System.out.println("Saldo rekening saat ini :" + saldo);
}

do{
Nasabah1.ceksaldo();
Nasabah2.ceksaldo();
public int tariktunai(int a) {
saldo = saldo - a;
return saldo;
}

System.out.println("Anda ingin melakukan:");
System.out.println("1.Kirim dana dari nasabah 1 ke nasabah 2");
System.out.println("2.Kirim dana dari nasabah 2 ke nasabah 1");
System.out.println("Masukkan pilihan anda :");
int pil=input1.nextInt();
public int terimauang(int a) {
saldo = saldo + a;
return saldo;
}

System.out.println("Masukkan jumlah uang yang ingin anda kirim :");
int x1=input2.nextInt();
public static void main(String args[]) {
Nasabah Nasabah1 = new Nasabah("Hamdan", 001, 2000000);
Nasabah Nasabah2 = new Nasabah("vera", 002, 3000000);
Scanner input1 = new Scanner(System.in);
Scanner input2 = new Scanner(System.in);

System.out.println("===Dana anda telah berhasil di transfer sejumlah :"+x1+"===");
if (pil==1){
Nasabah1.tariktunai(x1);
Nasabah2.terimauang(x1);
}
else if (pil==2){
Nasabah2.tariktunai(x1);
Nasabah1.terimauang(x1);
}
else System.out.println("maaf pilihan tidak ada");
do {
Nasabah1.ceksaldo();
Nasabah2.ceksaldo();

Nasabah1.ceksaldo();
Nasabah2.ceksaldo();
}
while (Nasabah1.saldo>0&&Nasabah2.saldo>0);
System.out.println("~~~Maaf saldo anda habis~~~");

}
System.out.println("Anda ingin melakukan:");
System.out.println("1.Kirim dana dari nasabah 1 ke nasabah 2");
System.out.println("2.Kirim dana dari nasabah 2 ke nasabah 1");
System.out.println("Masukkan pilihan anda :");
int pil = input1.nextInt();

System.out.println("Masukkan jumlah uang yang ingin anda kirim :");
int x1 = input2.nextInt();

System.out.println("===Dana anda telah berhasil di transfer sejumlah :" + x1 + "===");
if (pil == 1) {
Nasabah1.tariktunai(x1);
Nasabah2.terimauang(x1);
} else if (pil == 2) {
Nasabah2.tariktunai(x1);
Nasabah1.terimauang(x1);
} else System.out.println("maaf pilihan tidak ada");

Nasabah1.ceksaldo();
Nasabah2.ceksaldo();
} while (Nasabah1.saldo > 0 && Nasabah2.saldo > 0);
System.out.println("~~~Maaf saldo anda habis~~~");
}
}
89 changes: 43 additions & 46 deletions OOPonline/src/main/java/com/mycompany/ooponline/OOPonline.java
Original file line number Diff line number Diff line change
@@ -1,50 +1,47 @@

package com.mycompany.ooponline;

import java.util.Scanner;
/**
*
* @author Hamdan Zulfa Rais (2003015034)
*/

/** @author Hamdan Zulfa Rais (2003015034) */
public class OOPonline {
public static void main(String args[]){
Scanner input1=new Scanner(System.in);
Scanner input2=new Scanner(System.in);
Scanner input3=new Scanner(System.in);
Scanner input4=new Scanner(System.in);
int ulang;
//Titik Looping
do{
System.out.println("selamat datang di aplikasi kalkulator ini \n\n"
+ "Masukkan Angka Pertama : ");
int a=input1.nextInt();
System.out.println("Masukkan Angka Kedua : ");
int b=input2.nextInt();
float c = 0;
System.out.println("Menu yang tersedia : ");
System.out.println("1)Penjumlahan 2)Pengurangan 3)Pembagian 4)Perkalian");
System.out.println("Pilih operasi yang mau dilakukan");
int pil=input3.nextInt();

if(pil==1){
c=a+b;
System.out.println("Hasil Penjumlahan Kedua Bilangan adalah : ");
}
if(pil==2){
c=a-b;
System.out.println("Hasil Pengurangan Kedua Bilangan adalah : ");
}
if(pil==3){
c=a/b;
System.out.println("Hasil Pembagian Kedua Bilangan adalah : ");
}
if(pil==4){
c=a*b;
System.out.println("Hasil Perkalian Kedua Bilangan adalah : ");
}
System.out.println(c);
System.out.println("Tekan angka 1 jika mau diulang");
ulang=input4.nextInt();
}
while(ulang==1);
}
public static void main(String args[]) {
Scanner input1 = new Scanner(System.in);
Scanner input2 = new Scanner(System.in);
Scanner input3 = new Scanner(System.in);
Scanner input4 = new Scanner(System.in);
int ulang;
// Titik Looping
do {
System.out.println(
"selamat datang di aplikasi kalkulator ini \n\n" + "Masukkan Angka Pertama : ");
int a = input1.nextInt();
System.out.println("Masukkan Angka Kedua : ");
int b = input2.nextInt();
float c = 0;
System.out.println("Menu yang tersedia : ");
System.out.println("1)Penjumlahan 2)Pengurangan 3)Pembagian 4)Perkalian");
System.out.println("Pilih operasi yang mau dilakukan");
int pil = input3.nextInt();

if (pil == 1) {
c = a + b;
System.out.println("Hasil Penjumlahan Kedua Bilangan adalah : ");
}
if (pil == 2) {
c = a - b;
System.out.println("Hasil Pengurangan Kedua Bilangan adalah : ");
}
if (pil == 3) {
c = a / b;
System.out.println("Hasil Pembagian Kedua Bilangan adalah : ");
}
if (pil == 4) {
c = a * b;
System.out.println("Hasil Perkalian Kedua Bilangan adalah : ");
}
System.out.println(c);
System.out.println("Tekan angka 1 jika mau diulang");
ulang = input4.nextInt();
} while (ulang == 1);
}
}
30 changes: 14 additions & 16 deletions PerangBintang/Alien.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
* Write a description of class Alien here.
*
* @author (your name)
*
* @author (your name)
* @version (a version number or a date)
*/
public class Alien extends Actor
{
/**
* Act - do whatever the Alien wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
setLocation(getX(), getY()+5);
if(getY()>=499){
setLocation(Greenfoot.getRandomNumber(300),0);
}
// Add your action code here.
public class Alien extends Actor {
/**
* Act - do whatever the Alien wants to do. This method is called whenever the 'Act' or 'Run'
* button gets pressed in the environment.
*/
public void act() {
setLocation(getX(), getY() + 5);
if (getY() >= 499) {
setLocation(Greenfoot.getRandomNumber(300), 0);
}
// Add your action code here.
}
}
48 changes: 21 additions & 27 deletions PerangBintang/MyWorld.java
Original file line number Diff line number Diff line change
@@ -1,34 +1,28 @@
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
* Write a description of class MyWorld here.
*
* @author (your name)
*
* @author (your name)
* @version (a version number or a date)
*/
public class MyWorld extends World
{
public class MyWorld extends World {

/**
* Constructor for objects of class MyWorld.
*
*/
public MyWorld()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(300, 500, 1);
prepare();
}

/**
* Prepare the world for the start of the program.
* That is: create the initial objects and add them to the world.
*/
private void prepare()
{
Alien alien = new Alien();
addObject(alien,139,83);
alien.setLocation(167,79);
alien.setLocation(135,80);
}
/** Constructor for objects of class MyWorld. */
public MyWorld() {
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(300, 500, 1);
prepare();
}

/**
* Prepare the world for the start of the program. That is: create the initial objects and add
* them to the world.
*/
private void prepare() {
Alien alien = new Alien();
addObject(alien, 139, 83);
alien.setLocation(167, 79);
alien.setLocation(135, 80);
}
}
25 changes: 11 additions & 14 deletions PerhitunganGajiPengajar/src/HitungGaji/Dekan.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,17 @@
*/
package HitungGaji;

/**
*
* @author EDO
*/
/** @author EDO */
public class Dekan extends DosenTetap {
int tunjangan;

public Dekan (int a, int b, int c, int d, int e){
super(a, b, c, d);
this.tunjangan=e;
}
int hitunggaji(int d, int e){
totalupah=super.hitunggaji(d,e)+tunjangan;
int tunjangan;

public Dekan(int a, int b, int c, int d, int e) {
super(a, b, c, d);
this.tunjangan = e;
}

int hitunggaji(int d, int e) {
totalupah = super.hitunggaji(d, e) + tunjangan;
return totalupah;

}
}
}
33 changes: 13 additions & 20 deletions PerhitunganGajiPengajar/src/HitungGaji/Dosen.java
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
package HitungGaji;

import java.util.Scanner;

/**
*
* @author EDO
*/
/** @author EDO */
public class Dosen {
int upahsks;
int transport;
int totalupah;

Dosen (int a, int b, int c) {
this.upahsks=a;
this.transport=b;
this.totalupah=c;
}
int upahsks;
int transport;
int totalupah;

int hitunggaji (int d, int e){
totalupah=(upahsks*d)+(transport*e);
return totalupah;

Dosen(int a, int b, int c) {
this.upahsks = a;
this.transport = b;
this.totalupah = c;
}

}
int hitunggaji(int d, int e) {
totalupah = (upahsks * d) + (transport * e);
return totalupah;
}
}
Loading