ventsislav83

Untitled

May 24th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class SubmitAsolution {
  4. public static void main(String[] args) {
  5.  
  6. Scanner scan = new Scanner(System.in);
  7.  
  8. String city = scan.nextLine();
  9. double sold = Double.parseDouble(scan.nextLine());
  10. double comision = 0d;
  11.  
  12. if (city.equalsIgnoreCase("Sofia")) {
  13.  
  14. if (sold > 0 && sold <= 500) {
  15. comision = 0.05;
  16. } else if (sold > 500 && sold <= 1000) {
  17. comision = 0.07;
  18. } else if (sold > 1000 && sold <= 10000) {
  19. comision = 0.08;
  20. } else if (sold > 10000) {
  21. comision = 0.12;
  22. }else {
  23. System.out.println("error");
  24. }
  25. }
  26. if (city.equalsIgnoreCase("Varna")) {
  27.  
  28. if (sold > 0 && sold <= 500) {
  29. comision = 0.045;
  30. } else if (sold > 500 && sold <= 1000) {
  31. comision = 0.075;
  32. } else if (sold > 1000 && sold <= 10000) {
  33. comision = 0.1;
  34. } else if (sold > 10000) {
  35. comision = 0.13;
  36. } else {
  37. System.out.println("error");
  38. }
  39. }
  40. if (city.equalsIgnoreCase("Plovdiv")) {
  41.  
  42. if (sold > 0 && sold <= 500) {
  43. comision = 0.055;
  44. } else if (sold > 500 && sold <= 1000) {
  45. comision = 0.08;
  46. } else if (sold > 1000 && sold <= 10000) {
  47. comision = 0.12;
  48. } else if (sold > 10000) {
  49. comision = 0.145;
  50. }
  51. }
  52.  
  53. double sum = sold * comision;
  54. System.out.printf("%.2f", sum);
  55.  
  56. }
  57.  
  58.  
  59. }
Advertisement
Add Comment
Please, Sign In to add comment