Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Flowers {
- public static void main(String[] args) {
- Scanner console = new Scanner(System.in);
- int broiHrizantemi = Integer.parseInt(console.nextLine());
- int broiRozi = Integer.parseInt(console.nextLine());
- int broiLaleta = Integer.parseInt(console.nextLine());
- String season = console.nextLine();
- boolean isHoliday = console.nextLine().equals("Y");
- double hrizantemiPrice = 2.00;
- double roziPrice = 4.10;
- double laletaPrice = 2.50;
- switch (season) {
- case "Autumn":
- case "Winter":
- hrizantemiPrice = 3.75;
- roziPrice = 4.50;
- laletaPrice = 4.15;
- break;
- }
- double totalPrice = (broiHrizantemi * hrizantemiPrice) + (broiRozi * roziPrice) + (broiLaleta * laletaPrice);
- if(isHoliday){
- totalPrice += totalPrice * 0.15;
- }
- if (broiLaleta > 7 && season.equals("Spring")){
- totalPrice -= totalPrice * 0.05;
- }
- if(broiRozi >= 10 && season.equals("Winter")){
- totalPrice -= totalPrice * 0.10;
- }
- if (broiHrizantemi + broiRozi + broiLaleta > 20){
- totalPrice -= totalPrice * 0.20;
- }
- final int instalationFee = 2;
- totalPrice += instalationFee;
- System.out.printf("%.2f" , totalPrice);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment