Advertisement
veronikaaa86

Flowers1

Nov 3rd, 2017
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.58 KB | None | 0 0
  1. package Exam18December2016;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Demo {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         int hrizantemiBroi = Integer.parseInt(scanner.nextLine());
  10.         int roziBroi = Integer.parseInt(scanner.nextLine());
  11.         int laletaBroi = Integer.parseInt(scanner.nextLine());
  12.         String sezon = scanner.nextLine();
  13.         String praznikLiE = scanner.nextLine();
  14.  
  15.         double hrizantemicena = 0;
  16.         double rozicena = 0;
  17.         double laletacena = 0;
  18.         double cenatotal = 0;
  19.         int broiTotal = hrizantemiBroi + roziBroi + laletaBroi;
  20.  
  21.         if ("Spring".equals(sezon) || "Summer".equals(sezon)) {
  22.             hrizantemicena = 2 * hrizantemiBroi;
  23.             rozicena = 4.1 * roziBroi;
  24.             laletacena = 2.5 * laletaBroi;
  25.             cenatotal = hrizantemicena + rozicena + laletacena;
  26.             if ("Y".equals(praznikLiE)) {
  27.                 cenatotal = cenatotal + cenatotal * 0.15;
  28.                 if (laletaBroi > 7) {
  29.                     cenatotal = cenatotal - cenatotal * 0.05;
  30.                 }
  31.                 if (broiTotal > 20) {
  32.                     cenatotal = cenatotal - cenatotal * 0.2;
  33.  
  34.                 }
  35.             } else {
  36.                 if (laletaBroi > 7) {
  37.                     cenatotal = cenatotal - cenatotal * 0.05;
  38.                 }
  39.                 if (broiTotal > 20) {
  40.                     cenatotal = cenatotal - cenatotal * 0.2;
  41.  
  42.                 }
  43.             }
  44.  
  45.         }
  46.         else if ("Autumn".equals(sezon) || "Winter".equals(sezon)) {
  47.             hrizantemicena = 3.75 * hrizantemiBroi;
  48.             rozicena = 4.5 * roziBroi;
  49.             laletacena = 4.15 * laletaBroi;
  50.             cenatotal = hrizantemicena + rozicena + laletacena;
  51.             if ("Y".equals(praznikLiE)) {
  52.                 cenatotal = cenatotal + cenatotal * 0.15;
  53.                 if (roziBroi >= 10 && "Winter".equals(sezon)) {
  54.                     cenatotal = cenatotal - cenatotal * 0.1;
  55.                 }
  56.                 if (broiTotal > 20) {
  57.                     cenatotal = cenatotal - cenatotal * 0.2;
  58.                 }
  59.  
  60.             } else {
  61.                 if (roziBroi >= 10 && "Winter".equals(sezon)) {
  62.                     cenatotal = cenatotal - cenatotal * 0.1;
  63.                 }
  64.                 if (broiTotal > 20) {
  65.                     cenatotal = cenatotal - cenatotal * 0.2;
  66.  
  67.                 }
  68.  
  69.             }
  70.  
  71.         }
  72.  
  73.         double cenatotalAran = cenatotal + 2;
  74.         System.out.printf("%.2f", cenatotalAran);
  75.     }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement