Advertisement
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;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int orders = int.Parse(Console.ReadLine());
- int totalBooks = 0;
- double totalPrice = 0.0;
- // tuk si vurtim sqka edna poruchaka na kolkoto puti mi e order
- for (int i = 0; i < orders; i++)
- {
- int packets = int.Parse(Console.ReadLine());
- int booksPerPack = int.Parse(Console.ReadLine());
- double price = double.Parse(Console.ReadLine());
- int allBooks = packets * booksPerPack;
- double discount = 0.0;
- if (packets >= 10 && packets <= 19)
- {
- discount = 0.05;
- }
- else if (packets >= 20 && packets <= 29)
- {
- discount = 0.06;
- }
- else if (packets >= 30 && packets <= 39)
- {
- discount = 0.07;
- }
- else if (packets >= 40 && packets <= 49)
- {
- discount = 0.08;
- }
- else if (packets >= 50 && packets <= 59)
- {
- discount = 0.09;
- }
- else if (packets >= 60 && packets <= 69)
- {
- discount = 0.10;
- }
- else if (packets >= 70 && packets <= 79)
- {
- discount = 0.11;
- }
- else if (packets >= 80 && packets <= 89)
- {
- discount = 0.12;
- }
- else if (packets >= 90 && packets <= 99)
- {
- discount = 0.13;
- }
- else if (packets >= 100 && packets <= 109)
- {
- discount = 0.14;
- }
- else if (packets >= 110)
- {
- discount = 0.15;
- }
- else if (packets < 10)
- {
- discount = 0.0;
- }
- // ((allBooks * price) * discount) tova mi e kolko mi e otstupkata - (price * allBooks)
- double finalPrice = (price * allBooks) - ((allBooks * price) * discount);
- totalPrice = totalPrice + finalPrice;
- totalBooks = totalBooks + allBooks;
- }
- Console.WriteLine(totalBooks);
- Console.WriteLine("{0:F2}", totalPrice);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement