Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Travel_10 {
- public static void main(String[] args) {
- Scanner myScan = new Scanner(System.in);
- // • Първи ред – Бюджет, реално число в интервала [10.00...5000.00].
- //• Втори ред – Един от двата възможни сезона: „summer” или “winter”
- double budged = Double.parseDouble(myScan.nextLine());
- String season = myScan.nextLine();
- // summer or winter
- if(season.equals("summer")) {
- // travel somewhere in europe
- if(budged > 1000 ) {
- budged = budged * 0.9;
- System.out.println("Somewhere in Europe");
- System.out.printf("Hotel - %.2f", budged);
- // travel in the Balkans
- } else if (budged <= 1000 && budged > 100) {
- budged = budged * 0.4;
- System.out.println("Somewhere in Balkans");
- System.out.printf("Camp - %.2f", budged);
- // travel in Bulgaria
- } else if ( budged <= 100 ) {
- budged = budged * 0.3;
- System.out.println("Somewhere in Bulgaria");
- System.out.printf("Camp - %.2f", budged);
- }
- } else if (season.equals("winter")) {
- if(budged > 1000 ) {
- budged = budged * 0.9;
- System.out.println("Somewhere in Europe");
- System.out.printf("Hotel - %.2f", budged);
- // travel in the Balkans
- } else if (budged <= 1000 && budged > 100) {
- budged = budged * 0.8;
- System.out.println("Somewhere in Balkans");
- System.out.printf("Hotel - %.2f", budged);
- // travel in Bulgaria
- } else if ( budged <= 100 ) {
- budged = budged * 0.7;
- System.out.println("Somewhere in Bulgaria");
- System.out.printf("Hotel - %.2f", budged);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement