转载:http://blog.csdn.net/seattle1215/article/details/6657814
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
-
- namespace Cash
- {
- class Program
- {
- static void Main(string[] args)
- {
- (new Program()).run();
-
-
-
-
-
-
-
- printfOtherthing("static method is called.");
- Program program = new Program();
-
- program.printSomething("non-static menthod is called.");
- }
-
- public void run()
- {
- double dailyRate = readDouble("please enter your rate: ");
- int workDay = readInt("please enter your days of working: ");
- writeFee(calculate(dailyRate, workDay));
- }
-
- private void writeFee(double p)
- {
- Console.WriteLine("The consultant‘s fee is: {0}", p * 1.6);
- }
-
- private double calculate(double dailyRate, int workDay)
- {
- return dailyRate * workDay;
- }
-
- private int readInt(string p)
- {
- Console.WriteLine(p);
- string a = Console.ReadLine();
-
- return int.Parse(a);
- }
-
- private double readDouble(string p)
- {
- Console.WriteLine(p);
- string line = Console.ReadLine();
- return double.Parse(line);
- }
-
- private void printSomething(string a)
- {
- Console.WriteLine(a);
- }
-
- private static void printfOtherthing(string a)
- {
- Console.WriteLine(a);
- }
- }
- }