Program Random

//Contoh Program Random yang Pernah Digunakan Untuk Event Battle of JAVA untuk menentukan Pendamping/Tema Project

import java.io.*;
import java.util.*;
class data{
String[] nama = {“Retail”,”Travel”,”Hotel”,”Perpustakaan”,”Karaoke”};
public int nomer(){
int ambil = (int)(Math.random()*nama.length);
return ambil;
}
}

public class pendamping {
public static void main(String[] args) throws Exception{
Scanner input=new Scanner(System.in);
data yes=new data();
for(int i=1;i<=1;i++){
int nomor=yes.nomer();
System.out.println(“You Got !”+i+” = “+yes.nama[nomor]);
}
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *