SHARE
TWEET

Untitled

markov5534 Nov 19th, 2019 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class pisnaMiOtZadachiPo150Reda {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         System.out.print("Which town IVAILO: ");
  7.         String town = scanner.nextLine();
  8.         town = town.substring(0, 1).toUpperCase() + town.substring(1).toLowerCase();
  9.  
  10.  
  11.         System.out.print("How much did you sell IVAILO: ");
  12.  
  13.         double sales = Double.parseDouble(scanner.next());
  14.  
  15.         if ((!("Sofia".equals(town) || "Varna".equals(town) || "Plovdiv".equals(town))) && (sales < 0)) {
  16.             System.out.println("error");
  17.         } else if (town.equals("Sofia") && (sales >= 0 && sales <= 500)) {
  18.             double comiss = sales * 0.05;
  19.             System.out.printf("Commissionary: %.2f", comiss);
  20.  
  21.         } else if (town.equals("Sofia") && (sales >= 500 && sales <= 1000)) {
  22.             double comiss = sales * 0.07;
  23.             System.out.printf("Commissionary: %.2f", comiss);
  24.  
  25.         } else if (town.equals("Sofia") && (sales >= 1000 && sales <= 10000)) {
  26.             double comiss = sales * 0.08;
  27.             System.out.printf("Commissionary: %.2f", comiss);
  28.         } else if (town.equals("Sofia") && (sales >= 10000)) {
  29.             double comiss = sales * 0.12;
  30.             System.out.printf("Commissionary: %.2f", comiss);
  31.         } else if (town.equals("Varna") && (sales >= 0 && sales <= 500)) {
  32.             double comiss = sales * 0.045;
  33.             System.out.printf("Commissionary: %.2f", comiss);
  34.         } else if (town.equals("Varna") && (sales >= 500 && sales <= 1000)) {
  35.             double comiss = sales * 0.075;
  36.             System.out.printf("Commissionary: %.2f", comiss);
  37.         } else if (town.equals("Varna") && (sales >= 1000 && sales <= 10000)) {
  38.             double comiss = sales * 0.1;
  39.             System.out.printf("Commissionary: %.2f", comiss);
  40.         } else if (town.equals("Varna") && (sales >= 10000)) {
  41.             double comiss = sales * 0.13;
  42.             System.out.printf("Commissionary: %.2f", comiss);
  43.         } else if (town.equals("Plovdiv") && (sales >= 0 && sales <= 500)) {
  44.             double comiss = sales * 0.055;
  45.             System.out.printf("Commissionary: %.2f", comiss);
  46.  
  47.  
  48.         } else if (town.equals("Plovdiv") && (sales >= 500 && sales <= 1000)) {
  49.             double comiss = sales * 0.08;
  50.             System.out.printf("Commissionary: %.2f", comiss);
  51.         } else if (town.equals("Plovdiv") && (sales >= 1000 && sales <= 10000)) {
  52.             double comiss = sales * 0.12;
  53.             System.out.printf("Commissionary: %.2f", comiss);
  54.         } else if (town.equals("Plovdiv") && (sales >= 10000)) {
  55.             double comiss = sales * 0.07;
  56.             System.out.printf("Commissionary: %.2f", comiss);
  57.         }
  58.     }
  59. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top