Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. class GradeSwitch
  7. {
  8. static void Main()
  9. {
  10. Console.Write("Enter delivery type (X: Express|R:Regular) : ");
  11. string t = (Console.ReadLine());
  12.  
  13.  
  14. if (t == "R" || t == "E")
  15. {
  16. if (t == "R")
  17. {
  18. Console.Write("Enter weight of book (kilograms) : ");
  19. int x = int.Parse(Console.ReadLine());
  20.  
  21. if (x > 0)
  22. {
  23. if (0 <= x * 1000 && x * 1000 <= 2000) { Console.WriteLine("You have to pay {0:f2} bt. for sending {1} Type with {2:f2} kilograms", ((x * 1000) * 0.25), t, x); }
  24. if (2000 < x * 1000 && x * 1000 <= 5000) { Console.WriteLine("You have to pay {0:f2} bt. for sending {1} Type with {2:f2} kilograms", (((2 * 1000) * 0.25)) + ((x - 2) * 1000 * 0.35), t, x); }
  25. if (x * 1000 > 5000) { Console.WriteLine("You have to pay {0:f2} bt. for sending {1} Type with {2:f2} kilograms", (((2 * 1000) * 0.25)) + (((3 * 1000) * 0.35)) + ((x - 5) * 1000 * 0.45), t, x); }
  26. }
  27. else { Console.WriteLine("Invalid Weight"); }
  28. }
  29. if (t == "E")
  30. {
  31. Console.Write("Enter weight of book (kilograms) : ");
  32. int x = int.Parse(Console.ReadLine());
  33.  
  34. if (x > 0)
  35. {
  36. if (0 <= x * 1000 && x * 1000 <= 2000) { Console.WriteLine("You have to pay {0:f2} bt. for sending {1} Type with {2:f2} kilograms", ((x * 1000) * 0.25) + 50, t, x); }
  37. if (2000 < x * 1000 && x * 1000 <= 5000) { Console.WriteLine("You have to pay {0:f2} bt. for sending {1} Type with {2:f2} kilograms", (((2 * 1000) * 0.25)) + ((x - 2) * 1000 * 0.35) + 50, t, x); }
  38. if (x * 1000 > 5000) { Console.WriteLine("You have to pay {0:f2} bt. for sending {1} Type with {2:f2} kilograms", (((2 * 1000) * 0.25)) + (((3 * 1000) * 0.35)) + ((x - 5) * 1000 * 0.45) + 50, t, x); }
  39. }
  40. else { Console.WriteLine("Invalid Weight"); }
  41. }
  42. }
  43. else { Console.WriteLine("Invalid Type"); }
  44. Console.ReadLine();
  45. }
  46.  
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement