Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class HoneyHarvest_03 {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- String flowerType = scan.nextLine();
- int flowersCount = Integer.parseInt(scan.nextLine());
- String season = scan.nextLine();
- double honey = 0;
- switch (flowerType) {
- case "Sunflower":
- if (season.equals("Spring")) {
- honey = flowersCount * 10;
- } else if (season.equals("Summer")) {
- honey = flowersCount * 8;
- honey = honey * 1.1;
- } else if (season.equals("Autumn")) {
- honey = flowersCount * 12;
- honey = honey * 0.95;
- }
- break;
- case "Daisy":
- if (season.equals("Spring")) {
- honey = flowersCount * 12;
- honey = honey * 1.1;
- } else if (season.equals("Summer")) {
- honey = flowersCount * 8;
- honey = honey * 1.1;
- } else if (season.equals("Autumn")) {
- honey = flowersCount * 6;
- honey = honey * 0.95;
- }
- break;
- case "Lavender":
- if (season.equals("Spring")) {
- honey = flowersCount * 12;
- } else if (season.equals("Summer")) {
- honey = flowersCount * 8;
- honey = honey * 1.1;
- } else if (season.equals("Autumn")) {
- honey = flowersCount * 6;
- honey = honey * 0.95;
- }
- break;
- case "Mint":
- if (season.equals("Spring")) {
- honey = flowersCount * 10;
- honey = honey * 1.1;
- } else if (season.equals("Summer")) {
- honey = flowersCount * 12;
- honey = honey * 1.1;
- } else if (season.equals("Autumn")) {
- honey = flowersCount * 6;
- honey = honey * 0.95;
- }
- break;
- }
- System.out.printf("Total honey harvested: %.2f", honey);
- }
- }
Add Comment
Please, Sign In to add comment