zh_stoqnov

BookOrders

Nov 3rd, 2014
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.63 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Book_Orders
  8. {
  9. class BookOrders
  10. {
  11. static void Main(string[] args)
  12. {
  13. int n = int.Parse(Console.ReadLine());
  14. double bookPrice = 0;
  15. int numberOfPackets = 0;
  16. int booksPerPacket = 0;
  17. int allBooks = 0;
  18. int allBooksTogether = 0;
  19. double allBooksPrice = 0;
  20. for(int i = 0; i < n; i++)
  21. {
  22.  
  23. numberOfPackets = int.Parse(Console.ReadLine());
  24. booksPerPacket = int.Parse(Console.ReadLine());
  25. bookPrice = double.Parse(Console.ReadLine());
  26. allBooks = numberOfPackets * booksPerPacket;
  27. allBooksTogether += allBooks;
  28. if(numberOfPackets < 10)
  29. {
  30. allBooksPrice += allBooks * bookPrice;
  31. }
  32. else if (numberOfPackets >= 10 && numberOfPackets < 20)
  33. {
  34. bookPrice = bookPrice - bookPrice * 0.05;
  35. allBooksPrice += allBooks * bookPrice;
  36. }
  37. else if (numberOfPackets >= 20 && numberOfPackets < 30)
  38. {
  39. bookPrice = bookPrice - bookPrice * 0.06;
  40. allBooksPrice += allBooks * bookPrice;
  41. }
  42. else if (numberOfPackets >= 30 && numberOfPackets < 40)
  43. {
  44. bookPrice = bookPrice - bookPrice * 0.07;
  45. allBooksPrice += allBooks * bookPrice;
  46. }
  47. else if (numberOfPackets >= 40 && numberOfPackets < 50)
  48. {
  49. bookPrice = bookPrice - bookPrice * 0.08;
  50. allBooksPrice += allBooks * bookPrice;
  51. }
  52. else if (numberOfPackets >= 50 && numberOfPackets < 60)
  53. {
  54. bookPrice = bookPrice - bookPrice * 0.09;
  55. allBooksPrice += allBooks * bookPrice;
  56. }
  57. else if (numberOfPackets >= 60 && numberOfPackets < 70)
  58. {
  59. bookPrice = bookPrice - bookPrice * 0.10;
  60. allBooksPrice += allBooks * bookPrice;
  61. }
  62. else if (numberOfPackets >= 70 && numberOfPackets < 80)
  63. {
  64. bookPrice = bookPrice - bookPrice * 0.11;
  65. allBooksPrice += allBooks * bookPrice;
  66. }
  67. else if (numberOfPackets >= 80 && numberOfPackets < 90)
  68. {
  69. bookPrice = bookPrice - bookPrice * 0.12;
  70. allBooksPrice += allBooks * bookPrice;
  71. }
  72. else if (numberOfPackets >= 90 && numberOfPackets < 100)
  73. {
  74. bookPrice = bookPrice - bookPrice * 0.13;
  75. allBooksPrice += allBooks * bookPrice;
  76. }
  77. else if (numberOfPackets >= 100 && numberOfPackets < 110)
  78. {
  79. bookPrice = bookPrice - bookPrice * 0.14;
  80. allBooksPrice += allBooks * bookPrice;
  81. }
  82. else if (numberOfPackets >= 110)
  83. {
  84. bookPrice = bookPrice - bookPrice * 0.15;
  85. allBooksPrice += allBooks * bookPrice;
  86. }
  87. }
  88. Console.WriteLine(allBooksTogether);
  89. Console.WriteLine("{0:0.00}", allBooksPrice);
  90. }
  91. }
  92. }
Advertisement
Add Comment
Please, Sign In to add comment