TAILIEUCHUNG - Writing Methods

Viết phương pháp Trong bài tập sau đây, bạn sẽ tạo ra một phương pháp ứng dụng cho phép tính bao nhiêu một nhà tư vấn sẽ tính phí cho một số lượng nhất định ngày tư vấn tại một tỷ lệ cố định hàng ngày. | Writing Methods In the following exercises you ll create an application method that calculates how much a consultant would charge for a given number of consultancy days at a fixed daily rate. You will start by developing the logic for the application and then use the Generate Method Stub Wizard to help you write the methods that are used by this logic. Next you ll run these methods in a console application to get a feel for the program. Finally you ll use the Visual Studio 2005 debugger to step in and out of the method calls as they run. Develop the logic for the application 1. Using Visual Studio 2005 open the DailyRate project in the Microsoft Press Visual CSharp Step by Step Chapter 3 DailyRate folder in your My Documents folder. 2. In the Solution Explorer double-click the file to display the program in the Code and Text Editor window. 3. Add the following statements to the body of the run method 4. double dailyRate readDouble Enter your daily rate 5. int noOfDays readInt Enter the number of days writeFee calculateFee dailyRate noOfDays The run method is called by the Main method when the application starts the way in which it is called requires an understanding of classes which we will look at in Chapter 7 Creating and Managing Classes and Objects . The block of code you have just added to the run method calls the readDouble method which you will write shortly to ask the user for the daily rate for the consultant. The next statement calls the readInt method which you will also write to obtain the number of days. Finally the writeFee method to be written is called to display the results on the screen. Notice that the value passed to writeFee is the value returned by the calculateFee method the last one you will need to write which takes the daily rate and the number of days and calculates the total fee payable. NOTE Because you have not yet written the readDouble readInt writeFee or calculateFee methods IntelliSense does not display them when you .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.