Daily Rate

  1. #region Using directives 
  2.  
  3. using System; 
  4. using System.Collections.Generic; 
  5. using System.Text; 
  6.  
  7. #endregion 
  8.  
  9. namespace DailyRate 
  10.     class Program 
  11.     { 
  12.         static void Main(string[] args) 
  13.         { 
  14.             (new Program()).run(); 
  15.         } 
  16.  
  17.         public void run() 
  18.         { 
  19.             double dailyRate = readDouble("Enter your daily rate: "); 
  20.             int noOfDays = readInt("Enter the number of days: "); 
  21.             writeFee(calculateFee(dailyRate, noOfDays)); 
  22.         } 
  23.  
  24.         private void writeFee(double p) 
  25.         { 
  26.             Console.WriteLine("The consultant's fee is: {0}", p * 1.1); 
  27.         } 
  28.  
  29.         private double calculateFee(double dailyRate, int noOfDays) 
  30.         { 
  31.             return dailyRate * noOfDays; 
  32.         } 
  33.  
  34.         private int readInt(string p) 
  35.         { 
  36.             Console.Write(p); 
  37.             string line = Console.ReadLine(); 
  38.             return int.Parse(line); 
  39.         } 
  40.  
  41.         private double readDouble(string p) 
  42.         { 
  43.             Console.Write(p); 
  44.             string line = Console.ReadLine(); 
  45.             return double.Parse(line); 
  46.         } 
  47.     } 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章