Advertisement
marekov

PhoneBill_Telerik

Apr 2nd, 2020
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.70 KB | None | 0 0
  1. using System;
  2. namespace PhoneBill
  3. {
  4.     class Program
  5.     {
  6.         static void Main(string[] args)
  7.         {
  8.             int texts = int.Parse(Console.ReadLine());
  9.             int minutes = int.Parse(Console.ReadLine());
  10.             double planCost = 12.00;
  11.             double totalTax = 0.00;
  12.  
  13.             if (texts < 20 && minutes < 60)
  14.             {
  15.                 Console.WriteLine("0 additional messages for 0.00 levas");
  16.                 Console.WriteLine("0 additional minutes for 0.00 levas");
  17.                 Console.WriteLine("0.00 additional taxes");
  18.                 Console.WriteLine("12.00 total bill");
  19.             }
  20.             else
  21.             {
  22.                 double chargeText = 0.00;
  23.                 double chargeMinutes = 0.00;
  24.                 double taxOnText = 0.00;
  25.                 double taxOnMins = 0.00;
  26.  
  27.                 if (texts > 20)
  28.                 {
  29.                     chargeText = (texts - 20) * 0.06;
  30.                     taxOnText = 0.2 * chargeText;
  31.                     totalTax += taxOnText;
  32.                     Console.WriteLine($"{texts - 20} additional messages for {chargeText:F2} levas");
  33.                 }
  34.                 if (minutes > 60)
  35.                 {
  36.                     chargeMinutes = (minutes - 60) * 0.1;
  37.                     taxOnMins = 0.2 * chargeMinutes;
  38.                     totalTax += taxOnMins;
  39.                     Console.WriteLine($"{minutes - 60} additional minutes for {chargeMinutes:F2} levas");
  40.                 }
  41.                 Console.WriteLine($"{totalTax:f2} additional taxes");
  42.                 Console.WriteLine($"{planCost + taxOnText + taxOnMins + chargeText + chargeMinutes:F2} total bill");
  43.             }
  44.         }
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement