SlideShare a Scribd company logo
import java.util.Scanner;
public class Soal06{
public static void main(String args[]){
String tujuan="",dari="Binus University",lokasi1="Senayan City",
lokasi2="Puri Indah Mall", lokasi3="Taman Anggrek Mall";
char yn='n';
do{
int pilih, argo=0;
Scanner in = new Scanner(System.in);
System.out.println(" Welcome in
MurahCoi Taxinn");
System.out.println("Now We're at "+dari);
System.out.println("Choose your destination :");
System.out.println("1. "+lokasi1);
System.out.println("2. "+lokasi2);
System.out.println("3. "+lokasi3);
System.out.println("4. Cancel");
do{
try{
System.out.print("nPlease input your destination
[1..4] : ");
pilih = in.nextInt();
}catch(Exception e){
System.out.println("Wrong input");
pilih = -1;
}finally{
in.nextLine();
}
}while(pilih < 1 || pilih > 4);
switch(pilih){
case 1:
tujuan = lokasi1;
lokasi1 = dari;
dari = tujuan;
break;
case 2:
tujuan = lokasi2;
lokasi2 = dari;
dari = tujuan;
break;
case 3:
tujuan = lokasi2;
lokasi2 = dari;
dari = tujuan;
break;
}
System.out.println("nYour Destination "+tujuan);
System.out.println("nIt will cost about Rp.20.000");
do{
try{
System.out.print("nWant to be reminded when
argometer multiple of [1000,2000,2500]? ");
argo = in.nextInt();
}catch(Exception e){
System.out.println("Wrong input!");
argo = -1;
}finally{
in.nextLine();
}
}while(argo != 1000 && argo != 2000 && argo != 2500);
for(int harga=5000; harga<=20000 ; harga+=250 ){
System.out.println("nArgometer Value = "+harga);
if(harga == 5000) continue;
if(harga == 12500){
System.out.println("We are already
halfway....n");
}
if( (harga - 5000) % argo == 0){
do{
System.out.println("nYour Cost "+harga);
System.out.print("Do you want to get out
from the Taxi [y/n]? ");
yn = in.nextLine().charAt(0);
}while(yn!='y' && yn!='n');
}
if(yn == 'y') break;
}
}while(yn == 'n');
System.out.println("Thank You :P");
}
}

More Related Content

DOCX
array implementation
PDF
SPL 11.1 | Problems on Loop , Nested Loop
PPTX
4. pointers, arrays
PDF
[KOSSA] C++ Programming - 17th Study - STL #3
PDF
10CSL67 CG LAB PROGRAM 10
DOC
Exception Example in Python
PPTX
Visual Studio 2015: Increase your Productivity
KEY
Excelマクロはじめの一歩
array implementation
SPL 11.1 | Problems on Loop , Nested Loop
4. pointers, arrays
[KOSSA] C++ Programming - 17th Study - STL #3
10CSL67 CG LAB PROGRAM 10
Exception Example in Python
Visual Studio 2015: Increase your Productivity
Excelマクロはじめの一歩

What's hot (13)

PDF
10CSL67 CG LAB PROGRAM 8
PPTX
3. chapter ii
PDF
20181020 advanced higher-order function
PDF
Stl algorithm-Basic types
PPTX
4. chapter iii
PPTX
Array menu
PPTX
C Programming Language Part 4
PDF
Evolving Search Relevancy: Presented by James Strassburg, Direct Supply
PDF
PPTX
Oprerator overloading
DOCX
Assignment c++12
PDF
Static and const members
10CSL67 CG LAB PROGRAM 8
3. chapter ii
20181020 advanced higher-order function
Stl algorithm-Basic types
4. chapter iii
Array menu
C Programming Language Part 4
Evolving Search Relevancy: Presented by James Strassburg, Direct Supply
Oprerator overloading
Assignment c++12
Static and const members
Ad

Similar to Code (20)

TXT
Code javascript
TXT
Code
DOCX
Java Practical1 based on Basic assignment
PDF
What will be the output from the following code if the user enters 4.pdf
PDF
Simple 27 Java Program on basic java syntax
PDF
Insertion Sort Code
PDF
Simple Java Program for beginner with easy method.pdf
DOCX
Please copy and paste the code and explain why it won't work- It is su.docx
PDF
Java AssignmentWrite a program using sortingsorting bubble,sele.pdf
PDF
import java.util.Scanner;public class Digits { public static v.pdf
PDF
Hashing endereçamento aberto - main
DOCX
Java file
DOCX
Java file
PDF
mport java.io.; class Student { int rollno; String name; .pdf
DOCX
DOCX
PPTX
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...
TXT
Code
DOCX
java program assigment -2
TXT
クイズプログラム
Code javascript
Code
Java Practical1 based on Basic assignment
What will be the output from the following code if the user enters 4.pdf
Simple 27 Java Program on basic java syntax
Insertion Sort Code
Simple Java Program for beginner with easy method.pdf
Please copy and paste the code and explain why it won't work- It is su.docx
Java AssignmentWrite a program using sortingsorting bubble,sele.pdf
import java.util.Scanner;public class Digits { public static v.pdf
Hashing endereçamento aberto - main
Java file
Java file
mport java.io.; class Student { int rollno; String name; .pdf
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...
Code
java program assigment -2
クイズプログラム
Ad

Recently uploaded (20)

PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
Yogi Goddess Pres Conference Studio Updates
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
A systematic review of self-coping strategies used by university students to ...
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
Classroom Observation Tools for Teachers
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Lesson notes of climatology university.
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
Pharma ospi slides which help in ospi learning
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PDF
Trump Administration's workforce development strategy
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
master seminar digital applications in india
Chinmaya Tiranga quiz Grand Finale.pdf
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Yogi Goddess Pres Conference Studio Updates
human mycosis Human fungal infections are called human mycosis..pptx
A systematic review of self-coping strategies used by university students to ...
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Classroom Observation Tools for Teachers
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Lesson notes of climatology university.
O5-L3 Freight Transport Ops (International) V1.pdf
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Pharma ospi slides which help in ospi learning
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
Trump Administration's workforce development strategy
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Microbial disease of the cardiovascular and lymphatic systems
master seminar digital applications in india

Code

  • 1. import java.util.Scanner; public class Soal06{ public static void main(String args[]){ String tujuan="",dari="Binus University",lokasi1="Senayan City", lokasi2="Puri Indah Mall", lokasi3="Taman Anggrek Mall"; char yn='n'; do{ int pilih, argo=0; Scanner in = new Scanner(System.in); System.out.println(" Welcome in MurahCoi Taxinn"); System.out.println("Now We're at "+dari); System.out.println("Choose your destination :"); System.out.println("1. "+lokasi1); System.out.println("2. "+lokasi2); System.out.println("3. "+lokasi3); System.out.println("4. Cancel"); do{ try{ System.out.print("nPlease input your destination [1..4] : "); pilih = in.nextInt(); }catch(Exception e){ System.out.println("Wrong input"); pilih = -1; }finally{ in.nextLine(); } }while(pilih < 1 || pilih > 4); switch(pilih){ case 1: tujuan = lokasi1; lokasi1 = dari; dari = tujuan; break; case 2: tujuan = lokasi2; lokasi2 = dari; dari = tujuan; break; case 3: tujuan = lokasi2; lokasi2 = dari; dari = tujuan; break; } System.out.println("nYour Destination "+tujuan); System.out.println("nIt will cost about Rp.20.000"); do{ try{ System.out.print("nWant to be reminded when argometer multiple of [1000,2000,2500]? "); argo = in.nextInt(); }catch(Exception e){ System.out.println("Wrong input!"); argo = -1;
  • 2. }finally{ in.nextLine(); } }while(argo != 1000 && argo != 2000 && argo != 2500); for(int harga=5000; harga<=20000 ; harga+=250 ){ System.out.println("nArgometer Value = "+harga); if(harga == 5000) continue; if(harga == 12500){ System.out.println("We are already halfway....n"); } if( (harga - 5000) % argo == 0){ do{ System.out.println("nYour Cost "+harga); System.out.print("Do you want to get out from the Taxi [y/n]? "); yn = in.nextLine().charAt(0); }while(yn!='y' && yn!='n'); } if(yn == 'y') break; } }while(yn == 'n'); System.out.println("Thank You :P"); } }