Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.math.BigDecimal;
- import java.text.Format;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- BigDecimal budget = new BigDecimal(scanner.nextLine());
- String season = scanner.nextLine();
- String destinationResult = "";
- String holidayInformation = "";
- BigDecimal moneySpent = BigDecimal.ZERO;
- if (budget.compareTo(BigDecimal.valueOf(100.00)) <= 0){
- destinationResult = "Bulgaria";
- if (season.equals("summer")){
- moneySpent = BigDecimal.valueOf(0.30).multiply(budget);
- holidayInformation = String.format("Camp - %.2f", moneySpent);
- }else {
- moneySpent = BigDecimal.valueOf(0.70).multiply(budget);
- holidayInformation = String.format("Hotel - %.2f", moneySpent);
- }
- }else if (budget.compareTo(BigDecimal.valueOf(1000.00)) <= 0){
- destinationResult = "Balkans";
- if (season.equals("summer")){
- moneySpent = BigDecimal.valueOf(0.40).multiply(budget);
- holidayInformation = String.format("Camp - %.2f", moneySpent);
- }else{
- moneySpent = BigDecimal.valueOf(0.80).multiply(budget);
- holidayInformation = String.format("Hotel - %.2f", moneySpent);
- }
- }else {
- destinationResult = "Europe";
- moneySpent = BigDecimal.valueOf(0.90).multiply(budget);
- holidayInformation = String.format("Hotel - %.2f", moneySpent);
- }
- System.out.println(String.format("Somewhere in %s",destinationResult));
- System.out.println(holidayInformation);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement