SHARE
TWEET

HW03_03

a guest Sep 22nd, 2019 108 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace HW03_03
  4. {
  5.     class Program
  6.     {
  7.         public static void Main(string[] args)
  8.         {
  9.             Question();
  10.         }
  11.  
  12.         public static void Question()
  13.         {
  14.             string Books1;
  15.             Console.WriteLine("How many books did you get?");
  16.             Books1 = Console.ReadLine();
  17.  
  18.             int Books = int.Parse(Books1);
  19.  
  20.             if (6 <= Books)
  21.             {
  22.                 Console.WriteLine("Maxiumum number of books is 5!");
  23.                 Question();
  24.             }
  25.  
  26.             Console.WriteLine("For how many days?");
  27.             string Days1 = Console.ReadLine();
  28.             int Days = int.Parse(Days1);
  29.  
  30.             double Fine = FineAmount(Days);
  31.             Console.WriteLine("Your Fine is: $"+ Fine);
  32.  
  33.  
  34.         }
  35.  
  36.  
  37.         public static double FineAmount(int Days)
  38.         {
  39.             double Fine = 0;
  40.             double Fine1;
  41.  
  42.             while (22 >= Days)
  43.             {
  44.                 Fine = 0;
  45.             }                        
  46.             while (22 <= Days && 31 >= Days)
  47.             {
  48.                 Fine1 = Days - 21;
  49.                 Fine = Fine1 * 0.5;
  50.             }
  51.             while (31 <= Days)
  52.             {
  53.                 Fine1 = Days - 21;
  54.                 Fine = Fine1 * 0.8;
  55.             }
  56.  
  57.             return Fine;
  58.         }      
  59.     }
  60. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top