• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# задача 3.5

NikolayPresolski Dec 14th, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. package Java1program;
2.
3. import java.math.BigDecimal;
4. import java.text.DecimalFormat;
5. import java.util.Scanner;
6.
7. public class tri_dwe {
8.     public static void main(String[] args) {
9.         Scanner scanner = new Scanner(System.in);
10.         BigDecimal budjet = new BigDecimal(scanner.nextLine());
11.         String season = scanner.nextLine();
12.         String dastinationResult = "";
13.         String holidayInformation = "";
14.         BigDecimal moneySpent = new BigDecimal("0.00");
15.         DecimalFormat formattter = new DecimalFormat("0.00");
16.         if (budjet.compareTo(BigDecimal.valueOf(100.00)) <= 0) {
17.             dastinationResult = "Bulgaria";
18.             if (season.equals("summer")) {
19.                 moneySpent = BigDecimal.valueOf(0.30).multiply(budjet);
20.                 holidayInformation = String.format("Camp - %s",
21.                         formattter.format(moneySpent));
22.             } else {
23.                 moneySpent = BigDecimal.valueOf(0.70).multiply(budjet);
24.                 holidayInformation = String.format("Hotel- %s",
25.                         formattter.format(moneySpent));
26.             }
27.         } else if (budjet.compareTo(BigDecimal.valueOf(1000.00)) <= 0) {
28.             dastinationResult = "Balkans";
29.             if (season.equals("summer")) {
30.                 moneySpent = BigDecimal.valueOf(0.40).multiply(budjet);
31.                 holidayInformation = String.format("hotel-%s",
32.                         formattter.format(moneySpent));
33.             } else {
34.                 moneySpent = BigDecimal.valueOf(0.80).multiply(budjet);
35.                 holidayInformation = String.format("hotel - %s",
36.                         formattter.format(moneySpent));
37.             }
38.         } else {
39.             dastinationResult = "Europe";
40.             moneySpent = BigDecimal.valueOf(0.90).multiply(budjet);
41.             holidayInformation = String.format("Hotel-%s",
42.                     formattter.format(moneySpent));
43.         }
44.         System.out.println(String.format("Somewhere in %s",
45.                 dastinationResult));
46.         System.out.println(holidayInformation);
47.     }
48. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Not a member of Pastebin yet?