📄 http:^^www.cs.wisc.edu^~dsilva^cs110^c++^myc++^assg^program1^program1.html
字号:
Date: Mon, 11 Nov 1996 17:36:18 GMTServer: NCSA/1.5Content-type: text/htmlLast-modified: Tue, 05 Nov 1996 12:58:06 GMTContent-length: 6533<HTML><HEAD><TITLE>CS110: Program #1</TITLE></HEAD><BODY><H1>Program #1 -- Automobile Financing Problem</H1>This program is worth <EM>20%</EM>. <H2>Due Date</H2>This assignment is due on Tuesday, Nov 12<H2>Statement of the problem</H2>You have been hired by an Automobile Financing Firm. The firm's policy isthat the customer will pay an <B>equal amount of money</B>(<EM><B>A</B></EM>) each month until the loan is paid off. The monthlypayment for any particular customer is based on the <B>amount borrowed</B>(<EM><B>B</B></EM>), the <B>number of months</B> (<EM><B>m</B></EM>) forthe loan, and the <B>annual interest rate</B> (<EM><B>i</B></EM>) asin the following formula: <P> <IMG ALIGN=MID SRC="prog1-formula.gif" ALT="The formula is too complicated to view in text form; you need to see the picture"><P>The amount of money borrowed (<EM><B>B</B></EM>) can be calculated asfollows:<H3><B>B = P-T-D</B></H3>where <EM><B>P</B></EM> is the <B>Purchase Price</B> of the new car,<EM><B>T</B></EM> is the <B>Trade-in-value</B> of the new car and<EM><B>D</B></EM> is the <B>Down Payment</B> (the first large sum ofmoney paid by the customer towards covering the price of the new car).<P>Your employer wants you you to write a C++ program to solve thisproblem, even though you've only been taking C++ for a week! Thespecifications of the problem are as follows:<UL> <LI> Your program <EM>must</EM> display messages prompting the userfor the following pieces of information: <UL> <LI> Price of the new car <LI> Trade-in value of the old car <LI> Down payment <LI> The annual percent interest rate <LI> The period of loan (in number of months) </UL><BR> <LI> Your program <EM>must</EM> print out the following pieces ofinformation, with appropriate messages and <EM>in the order listedbelow</EM> <UL> <LI> Amount borrowed <LI> Total number of months <LI> Annual percent interest rate <LI> Monthly payment <LI> Total amount paid by customer over the life of the loan <LI> Total interest earned over the life of the loan <LI> A thank you message to the user with your name in it </UL></UL><H2>Test Cases</H2> To make sure your program runs correctly, your boss asks you torun it on the following test inputs. <UL> <LI><B>Case 1:</B> <UL> <LI> Price of new car: $15000 <LI> Trade-in-value of old car: $3000 <LI> Down Payment : $5000 <LI> The annual percent rate : 8% <LI> Period of loan : 24 months </UL> <LI><B>Case 2:</B> <UL> <LI> Price of new car: $25000 <LI> Trade-in-value of old car: $5000 <LI> Down Payment : $7000 <LI> The annual percent rate : 5% <LI> Period of loan : 36 months </UL> </UL><H2>What to turn in</H2>You should turn in the following three pages, <B>stapled together:</B><H3>You will lose 2 points if items are not stapled. No exceptions!</H3> <UL> <LI> (page 1) Printed listing of source file (probablyshould not be bigger than one page). This is to be done just like you did in program 0. <EM>Please be sure to type your name,username(login), and section number at the top along with your commentsabout what the program does. </EM> <LI> (pages 2 & 3) <STRONG> Printed output of your programruns on the two test cases. This can be done easily as follows: Aftereach run of your program, you pull down the little tab button on the upper left hand corner of the output window (the one with the INACTIVE at the top), and select the Print option . This will send all output generated by your program in this window to the printer.</STRONG> <LI> In addition, as for all assignments, <EM>you must turn in an online copy of your program's source code</EM>. Note that once you hand in your source file,it cannot be retrieved or changed in any way -- so be absolutely certainthat your program works before you turn it in. </UL><H2>Hints</H2><UL> <LI> You must #include <STRONG><math.h></STRONG> at the beginning of your program to use the <STRONG>pow(x,y)</STRONG> function as discussed in class. <LI> <STRONG>DO NOT USE SINGLE LETTER VARIABLE NAMES IN YOUR PROGRAM.</STRONG> </UL><H2>Sample Run</H2>To give you an idea about how your program must behave, I have provided you with a sample run of the program:<PRE WIDTH=80>Enter price of the new car: 30000
Enter trade-in-value of old car: 12000.3
Enter Down Payment: 3000.14
Enter the annual percent rate: 12.35
Enter the period of the loan: 36
Amount borrowed: 14999.5
Total number of months: 36
Annual percent interest rate: 12.35
Monthly payment: 500.708
Total amount paid by customer over period of loan: 18025.5
Total interest earned over life of loan: 3025.99Thanks for using TONY D'Silva's wonderful program!</PRE><H2>Grading</H2><UL> <LI> <B> CORRECT OUTPUT:</B> <UL> <LI> case 1: 3 <LI> case 2: 3 </UL> <LI> <B> USER INTERFACE:</B> <UL> <LI> Meaningful prompts to user: 2 <LI> Correct display of program output: 2 </UL> <LI> <B> IMPLEMENTATION:</B> <UL> <LI> Correct formula implementation: 3 <LI> Efficient formulation: 1 <LI> Meaningful variable names: 2 </UL> <LI> <B> DOCUMENTATION:</B> <UL> <LI> Program description: 2 <LI> Variable definition and section comments: 2 </UL> </UL></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -