13 Mei 2013

JAVA PROGRAM: GAMES TEBAK ANGKA

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gamestebakangka;

import java.util.Scanner;
import java.util.Random;

/**
 *
 * @author acer
 */
public class GamesTebakAngka {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner input = new Scanner (System.in);
        Random myRandom = new Random();
        int a = 0;
        int b;
        System.out.print("~~~GAMES TEBAK ANGKA~~~\n(Masukkan angka antara 1-100)\nGUD LUCK!\n");

        do {
            System.out.print("\nMasukkan Angka Tebakan Anda : ");
            b = input.nextInt();
            a= 1+myRandom.nextInt(100);
            if (b < a) {
            System.out.print(a+"\nKurang nih angkanya!\n\n");

            }
            else if (b>a) {
            System.out.print(a+"\nKebanyakan nih angkanya!\n\n");
            }
        }
        while (b != a);
            if (b == a) {
            System.out.print("\nYEAY!! Angka yang di maksud adalah " +a );
            }
        // TODO code application logic here
    }
}


******************************************************************************
Nihh outputnya ::
 

Tidak ada komentar:

Posting Komentar