TUGAS MANDIRI 3 LATIHAN JCREATOR
Lampu lalu lintas
Codding :
/**
* @(#)tugasifelse4.java
*
*
* @author
* @version 1.00 2015/2/24
*/
import java.io.*;
import java.util.Scanner;
public class tugasifelse4 {
public static void main (String[] args) {
int nilai;
Scanner tes = new Scanner (System.in);
System.out.print("Lampu lalu lintas = ");
nilai = tes.nextInt();
if (nilai==1)
System.out.println("jalan");
if (nilai==2)
System.out.println("berhenti");
if (nilai==3)
System.out.println("hati-hati");
}
}
Output :
Tidak ada komentar:
Posting Komentar