Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Book_Orders
- {
- class BookOrders
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- double bookPrice = 0;
- int numberOfPackets = 0;
- int booksPerPacket = 0;
- int allBooks = 0;
- int allBooksTogether = 0;
- double allBooksPrice = 0;
- for(int i = 0; i < n; i++)
- {
- numberOfPackets = int.Parse(Console.ReadLine());
- booksPerPacket = int.Parse(Console.ReadLine());
- bookPrice = double.Parse(Console.ReadLine());
- allBooks = numberOfPackets * booksPerPacket;
- allBooksTogether += allBooks;
- if(numberOfPackets < 10)
- {
- allBooksPrice += allBooks * bookPrice;
- }
- else if (numberOfPackets >= 10 && numberOfPackets < 20)
- {
- bookPrice = bookPrice - bookPrice * 0.05;
- allBooksPrice += allBooks * bookPrice;
- }
- else if (numberOfPackets >= 20 && numberOfPackets < 30)
- {
- bookPrice = bookPrice - bookPrice * 0.06;
- allBooksPrice += allBooks * bookPrice;
- }
- else if (numberOfPackets >= 30 && numberOfPackets < 40)
- {
- bookPrice = bookPrice - bookPrice * 0.07;
- allBooksPrice += allBooks * bookPrice;
- }
- else if (numberOfPackets >= 40 && numberOfPackets < 50)
- {
- bookPrice = bookPrice - bookPrice * 0.08;
- allBooksPrice += allBooks * bookPrice;
- }
- else if (numberOfPackets >= 50 && numberOfPackets < 60)
- {
- bookPrice = bookPrice - bookPrice * 0.09;
- allBooksPrice += allBooks * bookPrice;
- }
- else if (numberOfPackets >= 60 && numberOfPackets < 70)
- {
- bookPrice = bookPrice - bookPrice * 0.10;
- allBooksPrice += allBooks * bookPrice;
- }
- else if (numberOfPackets >= 70 && numberOfPackets < 80)
- {
- bookPrice = bookPrice - bookPrice * 0.11;
- allBooksPrice += allBooks * bookPrice;
- }
- else if (numberOfPackets >= 80 && numberOfPackets < 90)
- {
- bookPrice = bookPrice - bookPrice * 0.12;
- allBooksPrice += allBooks * bookPrice;
- }
- else if (numberOfPackets >= 90 && numberOfPackets < 100)
- {
- bookPrice = bookPrice - bookPrice * 0.13;
- allBooksPrice += allBooks * bookPrice;
- }
- else if (numberOfPackets >= 100 && numberOfPackets < 110)
- {
- bookPrice = bookPrice - bookPrice * 0.14;
- allBooksPrice += allBooks * bookPrice;
- }
- else if (numberOfPackets >= 110)
- {
- bookPrice = bookPrice - bookPrice * 0.15;
- allBooksPrice += allBooks * bookPrice;
- }
- }
- Console.WriteLine(allBooksTogether);
- Console.WriteLine("{0:0.00}", allBooksPrice);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment