Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //18. *Пътешествие Трета задача от изпита на 26 март 2016.
- import java.util.Scanner;
- public class Travelling {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double budget = Double.parseDouble(scanner.nextLine());
- String season = scanner.nextLine();
- String bulgaria = "Bulgaria";
- String balkans = "Balkans";
- String europe = "Europe";
- String destination = europe;
- String typeHolidays = "Hotel";
- double money = 0.0;
- if (budget <= 100) {
- destination = bulgaria;
- } else if (budget <= 1000) {
- destination = balkans;
- }
- if (season.equals("summer") && destination != europe){
- typeHolidays = "Camp";
- }
- if (destination == europe) {
- money = (budget * 90) /100;
- } else if(destination == balkans ){
- if (season.equals("summer")){
- money = (budget * 40) /100;
- } else {
- money = (budget * 80) /100;
- }
- } else if (destination == bulgaria){
- if (season.equals("summer")){
- money = (budget * 30) /100;
- } else {
- money = (budget * 70) /100;
- }
- }
- System.out.printf("Somewhere in %s %n", destination);
- System.out.printf("%s - %.2f", typeHolidays, money);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement