Nested If di Java

Sedikit berbagi dengan teman-teman yang mungkin masih mengalami kesulitan mengerjakan tugas Pemrograman Berbasis Java.

here’s the code..

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

class ifelse
{
public static void main( String[] args )

throws IOException
{
InputStreamReader inStream =new InputStreamReader(System.in);
BufferedReader dataIn = new BufferedReader(new InputStreamReader(System.in));
String inputData;
int nilai;

System.out.print(“Masukkan nilai anda = “);
inputData=dataIn.readLine();
nilai=Integer.parseInt(inputData);

if ((nilai >= 85 && nilai <= 100))
{
System.out.println(“Nilai Anda = A…Excellent”);
}
else if ((nilai >= 70 && nilai <= 84))
{
System.out.println(“Nilai Anda = B…Good…Good”);
}
else if ((nilai >= 55 && nilai <= 69))
{
System.out.println(“Nilai Anda = C…Lumayan Deh”);
}
else if ((nilai >= 30 && nilai <= 54))
{
System.out.println(“Nilai Anda = D…Ronda Ya??”);
}
else if ((nilai >= 0 && nilai <= 29))
{
System.out.println(“Nilai Anda = E…Besok Ngulang Ujian Lagi aja ya..”);
}
}
}

Penampakannya friend’s.

Advertisements
Nested If di Java

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s