Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class SubmitAsolution {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- String city = scan.nextLine();
- double sold = Double.parseDouble(scan.nextLine());
- double comision = 0d;
- if (city.equalsIgnoreCase("Sofia")) {
- if (sold > 0 && sold <= 500) {
- comision = 0.05;
- } else if (sold > 500 && sold <= 1000) {
- comision = 0.07;
- } else if (sold > 1000 && sold <= 10000) {
- comision = 0.08;
- } else if (sold > 10000) {
- comision = 0.12;
- }else {
- System.out.println("error");
- }
- }
- if (city.equalsIgnoreCase("Varna")) {
- if (sold > 0 && sold <= 500) {
- comision = 0.045;
- } else if (sold > 500 && sold <= 1000) {
- comision = 0.075;
- } else if (sold > 1000 && sold <= 10000) {
- comision = 0.1;
- } else if (sold > 10000) {
- comision = 0.13;
- } else {
- System.out.println("error");
- }
- }
- if (city.equalsIgnoreCase("Plovdiv")) {
- if (sold > 0 && sold <= 500) {
- comision = 0.055;
- } else if (sold > 500 && sold <= 1000) {
- comision = 0.08;
- } else if (sold > 1000 && sold <= 10000) {
- comision = 0.12;
- } else if (sold > 10000) {
- comision = 0.145;
- }
- }
- double sum = sold * comision;
- System.out.printf("%.2f", sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment