Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class TradeComissions {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String town = scanner.nextLine().toLowerCase();
- double target = Double.parseDouble(scanner.nextLine());
- double comission = -1;
- if (town.equals("sofia")) {
- if (target >= 0 && target <= 500) {
- comission = 5;
- } else if (target <= 1000) {
- comission = 7;
- } else if (target <= 10000) {
- comission = 8;
- } else if (target > 10000){
- comission = 12;
- } else {
- System.out.println("error");
- }
- } else if (town.equals("varna")) {
- if (target >= 0 && target <= 500) {
- comission = 4.5;
- } else if (target <= 1000) {
- comission = 7.5;
- } else if (target <= 10000) {
- comission = 10;
- } else if (target > 10000){
- comission = 13;
- } else {
- System.out.println("error");
- }
- } else if (town.equals("plovdiv")) {
- if (target < 0) {
- System.out.println("error");
- } else if (target >= 0 && target <= 500) {
- comission = 5.5;
- } else if (target <= 1000) {
- comission = 8;
- } else if (target <= 10000) {
- comission = 12;
- } else if (target > 10000){
- comission = 14.5;
- } else {
- System.out.println("error");
- }
- } else {
- System.out.println("error");
- }
- if (comission != -1) {
- System.out.printf("%.2f", target * (comission / 100));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment