⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 http:^^www.cs.wisc.edu^~milo^cs302^program2.html

📁 This data set contains WWW-pages collected from computer science departments of various universities
💻 HTML
字号:
Date: Mon, 11 Nov 1996 17:13:15 GMTServer: NCSA/1.5Content-type: text/htmlLast-modified: Mon, 16 Sep 1996 05:48:12 GMTContent-length: 4113<HTML><HEAD><TITLE>TITLE - CS 302 Fall 1996 - Section 4</TITLE></HEAD><BODY><H1 ALIGN=CENTER>  <!WA0><!WA0><!WA0><!WA0><!WA0><!WA0><!WA0><!WA0><!WA0><A HREF="http://www.cs.wisc.edu/~cs302">CS 302</A>  Fall 1996 - <!WA1><!WA1><!WA1><!WA1><!WA1><!WA1><!WA1><!WA1><!WA1><A HREF="http://www.cs.wisc.edu/~milo/cs302.html">Section 4</A></H1> <H2 ALIGN=CENTER>Algebraic Language Programming in C++</H2><H4 ALIGN=CENTER>Instructor:   <!WA2><!WA2><!WA2><!WA2><!WA2><!WA2><!WA2><!WA2><!WA2><A HREF="http://www.cs.wisc.edu/~milo">Milo M. Martin</A>   (milo@cs.wisc.edu)</H4><hr><br><H1 ALIGN=CENTER>Program 2</H1><H3 ALIGN=CENTER>Due Wednesday, September 25, 1996</H3> <hr><br>In program 2, you are a computer programmer who has been hired bya local restaurant to write a program for a new computer which willreplace an old cash register.  <p>The restaurant only has four items on the menu.  You may pick what thoseitems are and set prices for them (each item must have a different price).You need to keep a running total of what is ordered and keep looping untilthe cash register operator asks the program to print out the total bill.Also, you need to keep track of how many of each item are purchased anddisplay them in the final bill.  Be creative with the nameof your restaurant, what sorts of food your restaurant offers, and whatthe prices are (<I>ie, make up your own... don't just copy mine!</I>).<p>Here is an example of what your menu might look like.  The formattingdoes not need to be exactly like this, but all dollar amounts must beformatted to 2 decimal places.<PRE> 	 The Hamburger Shack	 -------------------------------	 A.  Hamburger            $1.00	 B.  Cheeseburger         $1.20	 C.  Double Cheeseburger  $2.40	 D.  Bacon Cheeseburger   $2.00	 Current Subtotal:  $0.00	 Enter your selection --></PRE><p>At this point, the cash register operator might press "A" (or, s/he might press "a".  Your program should do the same thing either way).You should add the cost of item A to the running subtotal and askthe operator if they are ready to print the final bill (the operatorwill enter "Y", "y", "N", or "n" as an answer).  If theoperator is not ready to print the bill yet, redisplay the menu with the updated subtotal:<PRE>	Enter your selection -->  <B>A</B>	New subtotal is $1.00	Would you like to print the bill now (Y or N)?  <B>N</B> 	The Hamburger Shack	-------------------------------	[...print your choices again...]	Current Subtotal: $1.00	Enter your selection --> </PRE><p>When the operator says that, yes, s/he would like to print out afinal bill, your program should print out an itemized list of whatwas ordered (and the total cost for each item), the subtotal, thesales tax (use 5% for sales tax), and the total (subtotal +sales tax).  For example:<PRE>	[...]	Would you like to print the bill now (Y or N)?  <B>Y</B>	Customer Bill	-------------	1 Hamburger	      $1.00	2 Cheeseburger	      $2.40	1 Bacon Cheeseburger  $2.00			     ------	Subtotal              $5.40	Sales Tax             $0.27                             ======	Amount Due            $5.67</PRE><p>Notice that two cheeseburgers were ordered in this example, so thecost is listed as 2 times $1.20, or $2.40.  Also notice that sinceno double cheeseburgers were ordered, they are not mentioned onthe bill (it does not say "<tt>0 Double Cheeseburger</tt>").  Theprogram should stop executing after the final bill is printed.<p><H3>What To Turn In</H3>Once you have your program working, use the print capabilities of theBorland output window (click on the upper left square in the output windowand then select "Print") to a create a printout of output whichdemonstrates all of the features of your program.  Your output printoutshould at least demonstrate ordering one of some item, ordering more thanone of some item, and not ordering any of a third item.  Submit print-outsof both your source code and your output and an electronic copy of yoursource code and executable file as before. <HR><ADDRESS>Created by<!WA3><!WA3><!WA3><!WA3><!WA3><!WA3><!WA3><!WA3><!WA3><A HREF = "http://www.cs.wisc.edu/~msteele">Mike Steele</A>, <!WA4><!WA4><!WA4><!WA4><!WA4><!WA4><!WA4><!WA4><!WA4><A HREF = "http://www.cs.wisc.edu/~milo">Milo Martin</A>& <!WA5><!WA5><!WA5><!WA5><!WA5><!WA5><!WA5><!WA5><!WA5><A HREF="http://www.cs.wisc.edu/~stenglei/stenglei.html">Jeremy Stenglein</A></ADDRESS></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -