Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class E03energyBooster{
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String fruit = scanner.nextLine();
- String size = scanner.nextLine();
- double sets = Double.parseDouble(scanner.nextLine());
- double small = 2;
- double big = 5;
- double waterMelonSmall = 56;
- double waterMelonBig = 28.70;
- double mangoSmall = 36.66;
- double mangoBig = 19.60;
- double pineappleSmall = 42.10;
- double pineappleBig = 24.80;
- double raspberrySmall = 20;
- double raspberryBig = 15.20;
- double sum = 0;
- if (fruit.equalsIgnoreCase("Watermelon")) {
- if (size.equalsIgnoreCase("big")) {
- sum = waterMelonBig * big * sets;
- }
- if (size.equalsIgnoreCase("small")) {
- sum = waterMelonSmall * small * sets;
- }
- }
- else if (fruit.equalsIgnoreCase("Mango")) {
- if (size.equalsIgnoreCase("big")) {
- sum = mangoBig * big * sets;
- }
- if (size.equalsIgnoreCase("small")) {
- sum = mangoSmall * small * sets;
- }
- }
- else if (fruit.equalsIgnoreCase("Pineapple")) {
- if (size.equalsIgnoreCase("big")) {
- sum = pineappleBig * big * sets;
- }
- if (size.equalsIgnoreCase("small")) {
- sum = pineappleSmall * small * sets;
- }
- }
- else if (fruit.equalsIgnoreCase("Raspberry")) {
- if (size.equalsIgnoreCase("big")) {
- sum = raspberryBig * big * sets;
- }
- if (size.equalsIgnoreCase("small")) {
- sum = raspberrySmall * small * sets;
- }
- }
- if (400 <= sum && sum <= 1000){
- sum = sum - (sum*0.15);
- }
- else if (sum > 1000){
- sum = sum - (sum*0.50);
- }
- System.out.printf("%.2f lv.", sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment