Programming Basics - java - задача
Здравейте,не ми печата нищо на кодът и да,знам,че мога "souf" да го направя за целия if и тн.,но не мога да разбера защо не ми отпечатва абсолютно нищо?
https://softuni.bg/trainings/resources/officedocument/12541/exercise-java-programming-basics-january-2017 - ЗАДАЧА 9
Кодът ми :
import java.util.Scanner; public class Voleyball { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String town = scanner.nextLine().toLowerCase(); double quanty = Double.parseDouble(scanner.nextLine()); double result = 0; if (town.equals("Sofia")) { if (quanty >= 0 && quanty <= 5000) { result = quanty * 0.05; System.out.printf("%.2f" ,result); } else if (quanty > 500 && quanty <= 1000) { result = quanty * 0.07; System.out.printf("%.2f" ,result); } else if (quanty > 1000 && quanty <= 10000) { result = quanty * 0.08; System.out.printf("%.2f" ,result); } else if (quanty > 10000) { result = quanty * 0.12; System.out.printf("%.2f" ,result); } System.out.printf("%.2f" ,result); } else if (town.equals("Varna")) { if (quanty >= 0 && quanty <= 5000) { result = quanty * 0.045; System.out.printf("%.2f" ,result); } else if (quanty > 500 && quanty <= 1000) { result = quanty * 0.75; System.out.printf("%.2f" ,result); } else if (quanty > 1000 && quanty <= 10000) { result = quanty * 0.1; System.out.printf("%.2f" ,result); } else if (quanty > 10000) { result = quanty * 0.13; System.out.printf("%.2f" ,result); } else if (town.equals("Plovdiv")) { if (quanty >= 0 && quanty <= 5000) { result = quanty * 0.055; System.out.printf("%.2f" ,result); } else if (quanty > 500 && quanty <= 1000) { result = quanty * 0.08; System.out.printf("%.2f" ,result); } else if (quanty > 1000 && quanty <= 10000) { result = quanty * 0.12; System.out.printf("%.2f" ,result); } else if (quanty > 10000) { result = quanty * 0.145; System.out.printf("%.2f" ,result); } } else { System.out.println("error"); } } } }
Да,бяхте.Вече ми дава някакви положителни стойности ,утре ще допрегледам.Благодаря :) !