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