Tugas Coding
Menentukan perbedaan harga di bioskop
Coding :
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author User
*/
import java.util.Scanner;
public class For1 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code applicati9on logic here
Scanner Bioskop=new Scanner(System.in);
System.out.print("Nomor Bangku = ");
int No=Bioskop.nextInt();
System.out.print("Hari = ");
int Hari=Bioskop.nextInt();
System.out.print("Kode Film = ");
int Judul=Bioskop.nextInt();
if(Hari==1){
System.out.println("Hari Senin");
System.out.println("Harga = Rp 25.000");
}else if (Hari=="2"){
System.out.println("Hari Selasa");
System.out.println("Harga = Rp 25.000");
}else if (Hari=="3"){
System.out.println("Hari Rabu");
System.out.println("Harga = Rp 30.000");
} else if (Hari=="4"){
System.out.println("Hari Kamis");
System.out.println("Harga = Rp 35.000");
} else if (Hari=="5"){
System.out.println("Hari Jum'at");
System.out.println("Harga = Rp 35.000");
} else if (Hari=="6"){
System.out.println("Hari Sabtu");
System.out.println("Harga = Rp 40.000");
} else if (Hari=="7"){
System.out.println("Hari Minggu");
System.out.println("Harga = Rp 50.000");
}
if(Judul==1){
System.out.println("1. Annabelle");
} else if (Judul==2 ){
System.out.println("2. 5 CM ");
} else if(Judul==3){
System.out.println("3. Frozen");
} else if(Judul==4){
System.out.println("4. The Raid ");
}
}
}
Coding :
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author User
*/
import java.util.Scanner;
public class For1 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code applicati9on logic here
Scanner Bioskop=new Scanner(System.in);
System.out.print("Nomor Bangku = ");
int No=Bioskop.nextInt();
System.out.print("Hari = ");
int Hari=Bioskop.nextInt();
System.out.print("Kode Film = ");
int Judul=Bioskop.nextInt();
if(Hari==1){
System.out.println("Hari Senin");
System.out.println("Harga = Rp 25.000");
}else if (Hari=="2"){
System.out.println("Hari Selasa");
System.out.println("Harga = Rp 25.000");
}else if (Hari=="3"){
System.out.println("Hari Rabu");
System.out.println("Harga = Rp 30.000");
} else if (Hari=="4"){
System.out.println("Hari Kamis");
System.out.println("Harga = Rp 35.000");
} else if (Hari=="5"){
System.out.println("Hari Jum'at");
System.out.println("Harga = Rp 35.000");
} else if (Hari=="6"){
System.out.println("Hari Sabtu");
System.out.println("Harga = Rp 40.000");
} else if (Hari=="7"){
System.out.println("Hari Minggu");
System.out.println("Harga = Rp 50.000");
}
if(Judul==1){
System.out.println("1. Annabelle");
} else if (Judul==2 ){
System.out.println("2. 5 CM ");
} else if(Judul==3){
System.out.println("3. Frozen");
} else if(Judul==4){
System.out.println("4. The Raid ");
}
}
}
Komentar
Posting Komentar