Created
September 17, 2017 12:50
-
-
Save naijab/eff65a8ece364b975bfec6c4f33863b8 to your computer and use it in GitHub Desktop.
Price tour
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Price { | |
public static void main(String[] args) { | |
Scanner tour = new Scanner(System.in); | |
System.out.print("Insert place[Krabi, Pattaya, Chaingmai]: "); | |
String place = tour.next(); | |
int tourin = tourDays(place); | |
System.out.println("Price of your trip : " + tourin); | |
System.out.print("Days? : "); | |
int day = tour.nextInt(); | |
System.out.println("Price of days : " + (day * 1500)); | |
System.out.println("Total of your tour : " + (tourin + (day) * 1500)); | |
tour.close(); | |
} | |
public static int tourDays(String one) { | |
String k = "Krabi", p = "Pattaya", c = "Chaingmai"; | |
int price = 0; | |
if (one.equalsIgnoreCase(k)) { | |
price = 1000; | |
} else if (one.equalsIgnoreCase(p)) { | |
price = 1500; | |
} else if (one.equalsIgnoreCase(c)) { | |
price = 2000; | |
} | |
return price; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment