Thread: [Dev-C++] student needs a little help
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Marton R. <mar...@ho...> - 2002-02-15 22:24:17
|
<html><div style='background-color:'><DIV>
<P>Hello Everyone,</P>
<P>I'm currently a CS Student and need a little help. I have been given the enclosed programming assignment but I'm not sure how to do it. It seems like a simple problem to solve but I don't know how to do list let and from the looks of the problem it will need one. I guess the teacher things we are supposed to know how to do list already.</P>
<P>Anyhow, I'd like a few pointers on how to do this problem if possible. Maybe how to do the part of the code where it would require a list and search.</P>
<P>Any help is appreciated, thanks.</P>
<P>Marton<BR></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B>Program #2:<SPAN style="mso-spacerun: yes"> </SPAN><I>Grocery Store Checkout<SPAN style="mso-spacerun: yes"> </SPAN></I>(60 points)<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></B></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p> </o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">Your assignment is to write, run, and test a C++ program, <B>pg2</B>, to simulate the operation of a<o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">grocery store checkout system. Your program should first build a data structure to contain<o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">information on all the products available in the store. Then the program should print the cash <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">register receipt for each customer. </P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p> </o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B>INPUT<o:p></o:p></B></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">The input for <B>pg2</B> has two sources: the inventory information is input from a text file, <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">and the customer transactions are input from the keyboard.<o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p> </o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">1. The information about each product carried by the store is listed on a single line in the<o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-spacerun: yes"> </SPAN>inventory file <B>invent.dat</B>", in the following format:<o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-tab-count: 2"> </SPAN><<I>product number</I>> <d<I>escription</I>> <<I>price</I>> <<I>tax</I>><o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-spacerun: yes"> </SPAN>where <product number> is a five-digit positive (nonzero) integer, <description> is a string of <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-spacerun: yes"> </SPAN>at most 12 characters with no embedded blanks, <price> is a real number, and <tax> is a <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-spacerun: yes"> </SPAN>character ('T' if the product is taxable; 'N' if it is not taxable). The data in the inventory file is <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-spacerun: yes"> </SPAN><U>ordered</U> from smallest to largest product number.<o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p> </o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">2. The customer transactions are input from the keyboard, in the following format:<o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-tab-count: 2"> </SPAN><<I>product number</I>> <<I>times</I>><o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-spacerun: yes"> </SPAN>where <product number> is as described above, and <times> is an integer in the range 1 to 100, <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-spacerun: yes"> </SPAN>indicating the quantity of this product desired. A zero input for <product number> indicates the <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-spacerun: yes"> </SPAN>end of the customer's order. (The store will soon be using a scanner to input the product number, <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-spacerun: yes"> </SPAN>but for now it is typed in by the cashier.) <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p> </o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B>OUTPUT</B><o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p> </o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">The program outputs should be written to a text file called <B>receipts.out</B>", which can be printed<o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">out for purposes of determining your grade. <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p> </o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">1. The inventory information of <B>invent.dat</B> is echo printed to the output file. <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p> </o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">2. The cash register receipt for each customer is written to the output file. The receipts should be <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-spacerun: yes"> </SPAN>nicely formatted, with the product description (not the product number), number of items, item <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-spacerun: yes"> </SPAN>price, and total price for each product printed on a single line. At the end of each customer's <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-spacerun: yes"> </SPAN>order, the subtotal for all items, amount of tax on taxable items, and total bill should be printed, <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-spacerun: yes"> </SPAN>clearly labeled. (The tax rate is 7.5% for taxable items.) <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p> </o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B>PROCESSING<o:p></o:p></B></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p> </o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B>pg2</B> first reads in all of the inventory information from file <B>invent.dat</B>, echo printing the <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">information to the output file <B>receipts.out</B>. The program then prompts the cashier to begin inputting <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">the order for the first customer. This customer's order is processed, and the receipt is printed to the <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">output file.<o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">After each customer's order is processed, the program should ask the cashier if another customer is <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">to be processed. If the answer is 'Y', the program sets up to process the next customer; if the answer <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">is 'N', the program terminates with a friendly message. </P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p> </o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B>ERROR CHECKING<o:p></o:p></B></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p> </o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">The following input errors are possible and should be handled by <B>pg2</B><o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p> </o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">1. Duplicate <product number> in inventory file. Write an error message <U>to the output file</U> and <U>skip</U> <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-spacerun: yes"> </SPAN>the second entry. <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">2. <Product number> not in inventory file. Write an error message <U>on the receipt</U>, ignore that product <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-spacerun: yes"> </SPAN>number, and <U>continue</U> with the next item. <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">3. <Times> not in the specified range. Write an error message <U>to the output file</U>, ignore that line, and <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-spacerun: yes"> </SPAN><U>continue</U> with the next item. <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p> </o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B>EXAMPLE<o:p></o:p></B></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-spacerun: yes"></SPAN> </P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"> <?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /><v:stroke joinstyle="miter"></v:stroke><v:path o:connecttype="rect" gradientshapeok="t"></v:path><v:shape id=_x0000_s1028 style="MARGIN-TOP: 0.05pt; Z-INDEX: 1; MARGIN-LEFT: 0px; WIDTH: 477.9pt; POSITION: absolute; HEIGHT: 321.45pt; mso-wrap-style: none; v-text-anchor: top-baseline" type="#_x0000_t202" stroked="f" filled="f" fillcolor="#0c9"><v:textbox style="mso-fit-shape-to-text: t"></v:textbox></v:shape><SPAN style="Z-INDEX: 1; POSITION: absolute; mso-ignore: vglayout">
<TABLE cellSpacing=0 cellPadding=0 width="100%">
<TBODY>
<TR>
<TD style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent">
<DIV class=shape style="PADDING-RIGHT: 7.2pt; PADDING-LEFT: 7.2pt; PADDING-BOTTOM: 3.6pt; PADDING-TOP: 3.6pt" v:shape="_x0000_s1028">
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 2in; TEXT-INDENT: 0in; mso-list: l0 level1 lfo1; mso-layout-grid-align: none"><SPAN style="COLOR: black; FONT-FAMILY: Courier; mso-fareast-font-family: Courier; mso-bidi-font-family: Courier"><SPAN style="mso-list: Ignore"></SPAN></SPAN><SPAN style="COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Courier; mso-hansi-font-family: 'Times New Roman'"><SPAN style="mso-spacerun: yes"> </SPAN><I>From File</I> "Invent.in":</SPAN><SPAN style="COLOR: black; FONT-FAMILY: Times; mso-hansi-font-family: 'Times New Roman'"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Courier; mso-hansi-font-family: 'Times New Roman'"><SPAN style="mso-spacerun: yes"> </SPAN><SPAN style="mso-tab-count: 1"> </SPAN>11012 <SPAN style="mso-tab-count: 1"> </SPAN>gallon-milk<SPAN style="mso-spacerun: yes"> </SPAN><SPAN style="mso-tab-count: 1"> </SPAN>1.99 <SPAN style="mso-tab-count: 1"> </SPAN>N</SPAN><SPAN style="COLOR: black; FONT-FAMILY: Times; mso-hansi-font-family: 'Times New Roman'"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Courier; mso-hansi-font-family: 'Times New Roman'"><SPAN style="mso-spacerun: yes"> </SPAN><SPAN style="mso-tab-count: 1"> </SPAN>11014<SPAN style="mso-spacerun: yes"> </SPAN><SPAN style="mso-tab-count: 1"> </SPAN>butter<SPAN style="mso-spacerun: yes"> </SPAN><SPAN style="mso-tab-count: 1"> </SPAN>2.59<SPAN style="mso-spacerun: yes"> </SPAN><SPAN style="mso-tab-count: 1"> </SPAN>N</SPAN><SPAN style="COLOR: black; FONT-FAMILY: Times; mso-hansi-font-family: 'Times New Roman'"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Courier; mso-hansi-font-family: 'Times New Roman'"><SPAN style="mso-spacerun: yes"> </SPAN><SPAN style="mso-tab-count: 1"> </SPAN>11110<SPAN style="mso-spacerun: yes"> </SPAN><SPAN style="mso-tab-count: 1"> </SPAN>pie-shells<SPAN style="mso-spacerun: yes"> </SPAN><SPAN style="mso-tab-count: 1"> </SPAN>0.99 <SPAN style="mso-tab-count: 1"> </SPAN>N</SPAN><SPAN style="COLOR: black; FONT-FAMILY: Times; mso-hansi-font-family: 'Times New Roman'"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Courier; mso-hansi-font-family: 'Times New Roman'"><SPAN style="mso-spacerun: yes"> </SPAN><SPAN style="mso-tab-count: 1"> </SPAN>20115<SPAN style="mso-tab-count: 1"> </SPAN>laundry-soap<SPAN style="mso-spacerun: yes"> </SPAN><SPAN style="mso-tab-count: 1"> </SPAN>3.60 <SPAN style="mso-tab-count: 1"> </SPAN>T</SPAN><SPAN style="COLOR: black; FONT-FAMILY: Times; mso-hansi-font-family: 'Times New Roman'"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Courier; mso-hansi-font-family: 'Times New Roman'"><SPAN style="mso-spacerun: yes"> </SPAN><SPAN style="mso-tab-count: 1"> </SPAN>30005<SPAN style="mso-spacerun: yes"> </SPAN><SPAN style="mso-tab-count: 1"> </SPAN>homestyle-br<SPAN style="mso-spacerun: yes"> </SPAN>0.99 <SPAN style="mso-tab-count: 1"> </SPAN>N</SPAN><SPAN style="COLOR: black; FONT-FAMILY: Times; mso-hansi-font-family: 'Times New Roman'"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0in; mso-list: l0 level1 lfo1; mso-layout-grid-align: none"><SPAN style="COLOR: black; FONT-FAMILY: Courier; mso-fareast-font-family: Courier; mso-bidi-font-family: Courier"><SPAN style="mso-list: Ignore"></SPAN></SPAN><SPAN style="COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Courier; mso-hansi-font-family: 'Times New Roman'"><SPAN style="mso-spacerun: yes"> </SPAN><I>From keyboard</I> (one customer):</SPAN><SPAN style="COLOR: black; FONT-FAMILY: Times; mso-hansi-font-family: 'Times New Roman'"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Courier; mso-hansi-font-family: 'Times New Roman'"><SPAN style="mso-spacerun: yes"> </SPAN><SPAN style="mso-tab-count: 1"> </SPAN>11110<SPAN style="mso-spacerun: yes"> </SPAN>2</SPAN><SPAN style="COLOR: black; FONT-FAMILY: Times; mso-hansi-font-family: 'Times New Roman'"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Courier; mso-hansi-font-family: 'Times New Roman'"><SPAN style="mso-spacerun: yes"> </SPAN><SPAN style="mso-tab-count: 1"> </SPAN>40012<SPAN style="mso-spacerun: yes"> </SPAN>3</SPAN><SPAN style="COLOR: black; FONT-FAMILY: Times; mso-hansi-font-family: 'Times New Roman'"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Courier; mso-hansi-font-family: 'Times New Roman'"><SPAN style="mso-spacerun: yes"> </SPAN><SPAN style="mso-tab-count: 1"> </SPAN>20115<SPAN style="mso-spacerun: yes"> </SPAN>1</SPAN><SPAN style="COLOR: black; FONT-FAMILY: Times; mso-hansi-font-family: 'Times New Roman'"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Courier; mso-hansi-font-family: 'Times New Roman'"><SPAN style="mso-spacerun: yes"> </SPAN><SPAN style="mso-tab-count: 1"> </SPAN>0</SPAN><SPAN style="COLOR: black; FONT-FAMILY: Times; mso-hansi-font-family: 'Times New Roman'"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="COLOR: black; mso-ascii-font-family: Courier"> </SPAN><SPAN style="COLOR: black; FONT-FAMILY: Times; mso-hansi-font-family: 'Times New Roman'"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0in; mso-list: l0 level1 lfo1; mso-layout-grid-align: none"><SPAN style="COLOR: black; FONT-FAMILY: Courier; mso-fareast-font-family: Courier; mso-bidi-font-family: Courier"><SPAN style="mso-list: Ignore"></SPAN></SPAN><SPAN style="COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Courier; mso-hansi-font-family: 'Times New Roman'"><SPAN style="mso-spacerun: yes"> </SPAN><I>To "Receipts.out" file</I>:</SPAN><SPAN style="COLOR: black; FONT-FAMILY: Times; mso-hansi-font-family: 'Times New Roman'"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Courier; mso-hansi-font-family: 'Times New Roman'">---------------------------------------------------------</SPAN><SPAN style="COLOR: black; FONT-FAMILY: Times; mso-hansi-font-family: 'Times New Roman'"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /><st1:date Month="9" Day="10" Year="1998"><SPAN style="COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Courier; mso-hansi-font-family: 'Times New Roman'">SEP 10, 1998</SPAN></st1:date><SPAN style="COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Courier; mso-hansi-font-family: 'Times New Roman'"> </SPAN><st1:time Hour="18" Minute="0"><SPAN style="COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Courier; mso-hansi-font-family: 'Times New Roman'">6:00 pm</SPAN></st1:time><SPAN style="COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Courier; mso-hansi-font-family: 'Times New Roman'"> (* date and time optional *)</SPAN><SPAN style="COLOR: black; FONT-FAMILY: Times; mso-hansi-font-family: 'Times New Roman'"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Courier; mso-hansi-font-family: 'Times New Roman'">Customer 1</SPAN><SPAN style="COLOR: black; FONT-FAMILY: Times; mso-hansi-font-family: 'Times New Roman'"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Courier; mso-hansi-font-family: 'Times New Roman'">pie-shells<SPAN style="mso-spacerun: yes"> </SPAN>2<SPAN style="mso-spacerun: yes"> </SPAN>@<SPAN style="mso-spacerun: yes"> </SPAN>0.99<SPAN style="mso-spacerun: yes"> </SPAN>1.98</SPAN><SPAN style="COLOR: black; FONT-FAMILY: Times; mso-hansi-font-family: 'Times New Roman'"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Courier; mso-hansi-font-family: 'Times New Roman'">*** item 40012 not in inventory ***</SPAN><SPAN style="COLOR: black; FONT-FAMILY: Times; mso-hansi-font-family: 'Times New Roman'"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Courier; mso-hansi-font-family: 'Times New Roman'">laundry-soap<SPAN style="mso-spacerun: yes"> </SPAN>1<SPAN style="mso-spacerun: yes"> </SPAN>@<SPAN style="mso-spacerun: yes"> </SPAN>3.60<SPAN style="mso-spacerun: yes"> </SPAN>3.60 TX</SPAN><SPAN style="COLOR: black; FONT-FAMILY: Times; mso-hansi-font-family: 'Times New Roman'"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Courier; mso-hansi-font-family: 'Times New Roman'"><SPAN style="mso-tab-count: 1"> </SPAN>Subtotal<SPAN style="mso-spacerun: yes"> </SPAN>5.58</SPAN><SPAN style="COLOR: black; FONT-FAMILY: Times; mso-hansi-font-family: 'Times New Roman'"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Courier; mso-hansi-font-family: 'Times New Roman'"><SPAN style="mso-tab-count: 1"> </SPAN>Tax<SPAN style="mso-spacerun: yes"> </SPAN>0.27</SPAN><SPAN style="COLOR: black; FONT-FAMILY: Times; mso-hansi-font-family: 'Times New Roman'"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="COLOR: black; mso-ascii-font-family: Courier"> </SPAN><SPAN style="COLOR: black; FONT-FAMILY: Times; mso-hansi-font-family: 'Times New Roman'"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; mso-layout-grid-align: none"><SPAN style="COLOR: black; FONT-FAMILY: Courier; mso-bidi-font-family: Courier; mso-hansi-font-family: 'Times New Roman'"><SPAN style="mso-spacerun: yes"> </SPAN><SPAN style="mso-tab-count: 1"> </SPAN>Total<SPAN style="mso-spacerun: yes"> </SPAN>5.85</SPAN><SPAN style="COLOR: black"> <o:p></o:p></SPAN></P></DIV></TD></TR></TBODY></TABLE></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p> </o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B></B> </P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B></B> </P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B></B> </P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B></B> </P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B></B> </P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B></B> </P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B></B> </P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B></B> </P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B></B> </P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B></B> </P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B></B> </P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B></B> </P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B></B> </P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B></B> </P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B></B> </P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B></B> </P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B></B> </P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B></B> </P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B></B> </P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B></B> </P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B></B> </P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B>DATA STRUCTURE</B><o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p> </o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">The inventory information can be stored in a list of product records. Assume that the maximum <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">number of products is 50, for purposes of writing this program. As the data in the inventory file <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">is ordered from smallest to largest product number, it is very simple to insert the product records <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">into this data structure in order. You can use either a sequential or binary search to locate a product <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">number in the inventory.<o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">You should specify this data structure as an ADT, as described in the chapter; define and implement <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">a set of operations to encapsulate it. <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p> </o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B><o:p> </o:p></B></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B>TEST PLAN</B><o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p> </o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">Be sure to include test cases to test your error conditions in your test plan. <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p> </o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B>DELIVERABLES</B><o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p> </o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">1. A disk of the source code of the program <B>pg2</B> and all included files. <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">2. Hard copy of a listing of your implemented test plan.<o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">3. Hard copy of the output file, receipts.out", produced by running your program using the input <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="mso-spacerun: yes"> </SPAN>specified in your test plan.<o:p></o:p></P>
<P> </P></DIV></div><br clear=all><hr>Send and receive Hotmail on your mobile device: <a href='http://go.msn.com/bql/hmtag2_etl_EN.asp'>Click Here</a><br></html>
|
|
From: Jason H. <jas...@bt...> - 2002-02-15 23:17:12
|
Hi,
List structures are usualy taught early on in a programming course you =
may need to tell your teacher that you haven't yet been taught lists =
though? You may want to clarify whether you have to make your own list =
data type or if you can use a standardly available one. C++ defines a =
standard set of container objects that should be readily available in =
any up to date C++ distro, called the Standard Template Library (STL), =
and list is one of them. I would actualy use a map (also available in =
the STL) to implement the grocery list though. A map is a series =
<key><value> combinations, where you can look up a <value> using the =
<key> part. The STL also defines a range of access and search methods =
for you. However you may not be allowed to rely on ready made parts, =
although in the real world you would.
My best advise for you would be to arrange to talk to the teacher and =
ask about these things, because it would take a lot of effort to teach =
you about lists in a single e-mail. Books usualy have a whole chapter on =
them and how to use them. Try researching Algorithms and Abstract Data =
Types. There are probably some web-sites around that cover the subject =
too, anyone know any?
Jason.
----- Original Message -----=20
From: Marton Rusk=20
To: dev...@li...=20
Sent: Friday, February 15, 2002 10:23 PM
Subject: [Dev-C++] student needs a little help
Hello Everyone,
I'm currently a CS Student and need a little help. I have been given =
the enclosed programming assignment but I'm not sure how to do it. It =
seems like a simple problem to solve but I don't know how to do list let =
and from the looks of the problem it will need one. I guess the teacher =
things we are supposed to know how to do list already.
Anyhow, I'd like a few pointers on how to do this problem if possible. =
Maybe how to do the part of the code where it would require a list and =
search.
Any help is appreciated, thanks.
Marton
Program #2: Grocery Store Checkout (60 points)
=20
Your assignment is to write, run, and test a C++ program, pg2, to =
simulate the operation of a
grocery store checkout system. Your program should first build a data =
structure to contain
information on all the products available in the store. Then the =
program should print the cash=20
register receipt for each customer.=20
=20
INPUT
The input for pg2 has two sources: the inventory information is input =
from a text file,=20
and the customer transactions are input from the keyboard.
=20
1. The information about each product carried by the store is listed =
on a single line in the
inventory file "invent.dat", in the following format:
<product number> <description> <price> <tax>
where <product number> is a five-digit positive (nonzero) integer, =
<description> is a string of=20
at most 12 characters with no embedded blanks, <price> is a real =
number, and <tax> is a=20
character ('T' if the product is taxable; 'N' if it is not =
taxable). The data in the inventory file is=20
ordered from smallest to largest product number.
=20
2. The customer transactions are input from the keyboard, in the =
following format:
<product number> <times>
where <product number> is as described above, and <times> is an =
integer in the range 1 to 100,=20
indicating the quantity of this product desired. A zero input for =
<product number> indicates the=20
end of the customer's order. (The store will soon be using a =
scanner to input the product number,=20
but for now it is typed in by the cashier.)=20
=20
OUTPUT
=20
The program outputs should be written to a text file called =
"receipts.out", which can be printed
out for purposes of determining your grade.=20
=20
1. The inventory information of invent.dat is echo printed to the =
output file.=20
=20
2. The cash register receipt for each customer is written to the =
output file. The receipts should be=20
nicely formatted, with the product description (not the product =
number), number of items, item=20
price, and total price for each product printed on a single line. =
At the end of each customer's=20
order, the subtotal for all items, amount of tax on taxable items, =
and total bill should be printed,=20
clearly labeled. (The tax rate is 7.5% for taxable items.)=20
=20
PROCESSING
=20
pg2 first reads in all of the inventory information from file =
invent.dat, echo printing the=20
information to the output file receipts.out. The program then prompts =
the cashier to begin inputting=20
the order for the first customer. This customer's order is processed, =
and the receipt is printed to the=20
output file.
After each customer's order is processed, the program should ask the =
cashier if another customer is=20
to be processed. If the answer is 'Y', the program sets up to process =
the next customer; if the answer=20
is 'N', the program terminates with a friendly message.=20
=20
ERROR CHECKING
=20
The following input errors are possible and should be handled by pg2
=20
1. Duplicate <product number> in inventory file. Write an error =
message to the output file and skip=20
the second entry.=20
2. <Product number> not in inventory file. Write an error message on =
the receipt, ignore that product=20
number, and continue with the next item.=20
3. <Times> not in the specified range. Write an error message to the =
output file, ignore that line, and=20
continue with the next item.=20
=20
EXAMPLE
. From File "Invent.in":
11012 gallon-milk 1.99 N
11014 butter 2.59 N
11110 pie-shells 0.99 N
20115 laundry-soap 3.60 T
30005 homestyle-br 0.99 N
. From keyboard (one customer):
11110 2
40012 3
20115 1
0
=20
. To "Receipts.out" file:
---------------------------------------------------------
SEP 10, 1998 6:00 pm (* date and time optional *)
Customer 1
pie-shells 2 @ 0.99 1.98
*** item 40012 not in inventory ***
laundry-soap 1 @ 3.60 3.60 TX
Subtotal 5.58
Tax 0.27
=20
Total 5.85=20
=20
=20
DATA STRUCTURE
=20
The inventory information can be stored in a list of product records. =
Assume that the maximum=20
number of products is 50, for purposes of writing this program. As the =
data in the inventory file=20
is ordered from smallest to largest product number, it is very simple =
to insert the product records=20
into this data structure in order. You can use either a sequential or =
binary search to locate a product=20
number in the inventory.
You should specify this data structure as an ADT, as described in the =
chapter; define and implement=20
a set of operations to encapsulate it.=20
=20
=20
TEST PLAN
=20
Be sure to include test cases to test your error conditions in your =
test plan.=20
=20
DELIVERABLES
=20
1. A disk of the source code of the program pg2 and all included =
files.=20
2. Hard copy of a listing of your implemented test plan.
3. Hard copy of the output file, "receipts.out", produced by running =
your program using the input=20
specified in your test plan.
-------------------------------------------------------------------------=
-----
Send and receive Hotmail on your mobile device: Click Here
_______________________________________________ Dev-cpp-users mailing =
list Dev...@li... =
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|
|
From: Ioannis V. <no...@ya...> - 2002-02-16 03:46:50
|
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...] On Behalf Of Marton
Rusk
Sent: Saturday, February 16, 2002 12:24 AM
To: dev...@li...
Subject: [Dev-C++] student needs a little help
Hello Everyone,
I'm currently a CS Student and need a little help. I have been given the
enclosed programming assignment but I'm not sure how to do it. It seems
like a simple problem to solve but I don't know how to do list let and
from the looks of the problem it will need one. I guess the teacher
things we are supposed to know how to do list already.
Anyhow, I'd like a few pointers on how to do this problem if possible.
Maybe how to do the part of the code where it would require a list and
search.
Any help is appreciated, thanks.
Except of the fact that you can use the ready C++ list in <list> header
file, you can use an array too. In fact i do not see why you shoud use
any container at all.
Marton
Program #2: Grocery Store Checkout (60 points)
Your assignment is to write, run, and test a C++ program, pg2, to
simulate the operation of a
grocery store checkout system. Your program should first build a data
structure to contain
information on all the products available in the store. Then the program
should print the cash
register receipt for each customer.
A data structure example:
class product
{
unsigned product_number;
std::string description;
unsigned price;
unsigned tax;
public:
product(const unsigned &pn, const std::string &desc, const unsigned &pr,
const unsigned &tx): product_number(pn), description(desc), price(pr),
tax(tx) {}
const unsigned &get_product_number() const { return product_number; }
const std::string &get_desc() const { return description; }
const unsigned &get_price() const { return price; }
const unsigned &get_tax() const { return tax; }
void set_product_number(const unsigned &pr) { product_number=pr; }
void set_desc() { description=desc; }
// ...
};
INPUT
The input for pg2 has two sources: the inventory information is input
from a text file,
and the customer transactions are input from the keyboard.
1. The information about each product carried by the store is listed on
a single line in the
inventory file "invent.dat", in the following format:
<product number> <description> <price> <tax>
where <product number> is a five-digit positive (nonzero) integer,
<description> is a string of
at most 12 characters with no embedded blanks, <price> is a real
number, and <tax> is a
character ('T' if the product is taxable; 'N' if it is not taxable).
The data in the inventory file is
ordered from smallest to largest product number.
For every element you will do checking to see if the arguments comply
with these rules and then you will throw an exception for everyone it
doesn't. You will create an exception inheritance like this:
class general_exception
{
unsigned exc_id;
public:
general_exception(const unsigned int &id): exc_id(id) {}
virtual operator unsigned() { return exc_id; }
virtual ~general_exception {}
virtual const std::string & message() const=0;
};
class desc_exception: public general_exception
{
std::string msg;
// ...
};
Or something that fits you better.
2. The customer transactions are input from the keyboard, in the
following format:
<product number> <times>
where <product number> is as described above, and <times> is an
integer in the range 1 to 100,
indicating the quantity of this product desired. A zero input for
<product number> indicates the
end of the customer's order. (The store will soon be using a scanner
to input the product number,
but for now it is typed in by the cashier.)
You will throw exceptions in case of errors.
OUTPUT
The program outputs should be written to a text file called
"receipts.out", which can be printed
out for purposes of determining your grade.
1. The inventory information of invent.dat is echo printed to the output
file.
2. The cash register receipt for each customer is written to the output
file. The receipts should be
nicely formatted, with the product description (not the product
number), number of items, item
price, and total price for each product printed on a single line. At
the end of each customer's
order, the subtotal for all items, amount of tax on taxable items,
and total bill should be printed,
clearly labeled. (The tax rate is 7.5% for taxable items.)
PROCESSING
pg2 first reads in all of the inventory information from file
invent.dat, echo printing the
information to the output file receipts.out. The program then prompts
the cashier to begin inputting
the order for the first customer. This customer's order is processed,
and the receipt is printed to the
output file.
After each customer's order is processed, the program should ask the
cashier if another customer is
to be processed. If the answer is 'Y', the program sets up to process
the next customer; if the answer
is 'N', the program terminates with a friendly message.
ERROR CHECKING
The following input errors are possible and should be handled by pg2
1. Duplicate <product number> in inventory file. Write an error message
to the output file and skip
the second entry.
2. <Product number> not in inventory file. Write an error message on the
receipt, ignore that product
number, and continue with the next item.
3. <Times> not in the specified range. Write an error message to the
output file, ignore that line, and
continue with the next item.
EXAMPLE
. From File "Invent.in":
11012 gallon-milk 1.99 N
11014 butter 2.59 N
11110 pie-shells 0.99 N
20115 laundry-soap 3.60 T
30005 homestyle-br 0.99 N
. From keyboard (one customer):
11110 2
40012 3
20115 1
0
. To "Receipts.out" file:
---------------------------------------------------------
SEP 10, 1998 6:00 pm (* date and time optional *)
Customer 1
pie-shells 2 @ 0.99 1.98
*** item 40012 not in inventory ***
laundry-soap 1 @ 3.60 3.60 TX
Subtotal 5.58
Tax 0.27
Total 5.85
DATA STRUCTURE
The inventory information can be stored in a list of product records.
Assume that the maximum
number of products is 50, for purposes of writing this program. As the
data in the inventory file
is ordered from smallest to largest product number, it is very simple to
insert the product records
into this data structure in order. You can use either a sequential or
binary search to locate a product
number in the inventory.
You should specify this data structure as an ADT, as described in the
chapter; define and implement
a set of operations to encapsulate it.
TEST PLAN
Be sure to include test cases to test your error conditions in your test
plan.
DELIVERABLES
1. A disk of the source code of the program pg2 and all included files.
2. Hard copy of a listing of your implemented test plan.
3. Hard copy of the output file, "receipts.out", produced by running
your program using the input
specified in your test plan.
For sorting and deleted the elements you will place another field in the
class like bool erased; which you will mark as true when you delete a
record, and then you will copy the contents of the file in a temporary
file, sort them there and then copy them back without the logically
deleted records.
Ioannis
* Ioannis Vranos
* Programming pages: <http://www.noicys.d2g.com/>
http://www.noicys.d2g.com
* Alternative URL: <http://run.to/noicys> http://run.to/noicys
|
|
From: Kevin W. <ke...@me...> - 2002-02-19 22:05:32
|
Hi everyone,
It always pays to read the question carefully when you get an assignment
problem like this one.
Some key points are:
You can assume that there will only be up to 50 items in the inventory.
The question says to use a data structure for the items and define and
implement a set of operations to encapsulate it (sounds like a class? ).
Using a list (with a binary or linear search) is suggested - but it is
only a suggestion.
A lot of the work ( and therefore a lot of the marks) is concerned with
trapping errors and dealing with exceptions.
Personally, I would create an instance of a class for each item as it is
read from the dat file, and store a pointer to it in an array. For 50 items,
it doesn't seem worth the effort of using a binary tree. I like assignments
like these as there is plenty of scope to be creative!
Kev.
----- Original Message -----
From: Marton Rusk <mar...@ho...>
To: <dev...@li...>
Sent: Friday, February 15, 2002 10:23 PM
Subject: [Dev-C++] student needs a little help
> Hello Everyone,
>
> I'm currently a CS Student and need a little help. I have been given the
enclosed programming assignment but I'm not sure how to do it. It seems like
a simple problem to solve but I don't know how to do list let and from the
looks of the problem it will need one. I guess the teacher things we are
supposed to know how to do list already.
>
> Anyhow, I'd like a few pointers on how to do this problem if possible.
Maybe how to do the part of the code where it would require a list and
search.
>
> Any help is appreciated, thanks.
>
> Marton
>
>
> Program #2: Grocery Store Checkout (60 points)
>
>
>
> Your assignment is to write, run, and test a C++ program, pg2, to simulate
the operation of a
>
> grocery store checkout system. Your program should first build a data
structure to contain
>
> information on all the products available in the store. Then the program
should print the cash
>
> register receipt for each customer.
>
>
>
> INPUT
>
> The input for pg2 has two sources: the inventory information is input from
a text file,
>
> and the customer transactions are input from the keyboard.
>
>
>
> 1. The information about each product carried by the store is listed on a
single line in the
>
> inventory file "invent.dat", in the following format:
>
> <product number> <description> <price> <tax>
>
> where <product number> is a five-digit positive (nonzero) integer,
<description> is a string of
>
> at most 12 characters with no embedded blanks, <price> is a real
number, and <tax> is a
>
> character ('T' if the product is taxable; 'N' if it is not taxable).
The data in the inventory file is
>
> ordered from smallest to largest product number.
>
>
>
> 2. The customer transactions are input from the keyboard, in the following
format:
>
> <product number> <times>
>
> where <product number> is as described above, and <times> is an
integer in the range 1 to 100,
>
> indicating the quantity of this product desired. A zero input for
<product number> indicates the
>
> end of the customer's order. (The store will soon be using a scanner
to input the product number,
>
> but for now it is typed in by the cashier.)
>
>
>
> OUTPUT
>
>
>
> The program outputs should be written to a text file called
"receipts.out", which can be printed
>
> out for purposes of determining your grade.
>
>
>
> 1. The inventory information of invent.dat is echo printed to the output
file.
>
>
>
> 2. The cash register receipt for each customer is written to the output
file. The receipts should be
>
> nicely formatted, with the product description (not the product
number), number of items, item
>
> price, and total price for each product printed on a single line. At
the end of each customer's
>
> order, the subtotal for all items, amount of tax on taxable items, and
total bill should be printed,
>
> clearly labeled. (The tax rate is 7.5% for taxable items.)
>
>
>
> PROCESSING
>
>
>
> pg2 first reads in all of the inventory information from file invent.dat,
echo printing the
>
> information to the output file receipts.out. The program then prompts the
cashier to begin inputting
>
> the order for the first customer. This customer's order is processed, and
the receipt is printed to the
>
> output file.
>
> After each customer's order is processed, the program should ask the
cashier if another customer is
>
> to be processed. If the answer is 'Y', the program sets up to process the
next customer; if the answer
>
> is 'N', the program terminates with a friendly message.
>
>
>
> ERROR CHECKING
>
>
>
> The following input errors are possible and should be handled by pg2
>
>
>
> 1. Duplicate <product number> in inventory file. Write an error message to
the output file and skip
>
> the second entry.
>
> 2. <Product number> not in inventory file. Write an error message on the
receipt, ignore that product
>
> number, and continue with the next item.
>
> 3. <Times> not in the specified range. Write an error message to the
output file, ignore that line, and
>
> continue with the next item.
>
>
>
> EXAMPLE
>
>
>
> . From File "Invent.in":
>
> 11012 gallon-milk 1.99 N
>
> 11014 butter 2.59 N
>
> 11110 pie-shells 0.99 N
>
> 20115 laundry-soap 3.60 T
>
> 30005 homestyle-br 0.99 N
>
> . From keyboard (one customer):
>
> 11110 2
>
> 40012 3
>
> 20115 1
>
> 0
>
>
>
> . To "Receipts.out" file:
>
> ---------------------------------------------------------
>
> SEP 10, 1998 6:00 pm (* date and time optional *)
>
> Customer 1
>
> pie-shells 2 @ 0.99 1.98
>
> *** item 40012 not in inventory ***
>
> laundry-soap 1 @ 3.60 3.60 TX
>
> Subtotal 5.58
>
> Tax 0.27
>
>
>
> Total 5.85
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> DATA STRUCTURE
>
>
>
> The inventory information can be stored in a list of product records.
Assume that the maximum
>
> number of products is 50, for purposes of writing this program. As the
data in the inventory file
>
> is ordered from smallest to largest product number, it is very simple to
insert the product records
>
> into this data structure in order. You can use either a sequential or
binary search to locate a product
>
> number in the inventory.
>
> You should specify this data structure as an ADT, as described in the
chapter; define and implement
>
> a set of operations to encapsulate it.
>
>
>
>
>
> TEST PLAN
>
>
>
> Be sure to include test cases to test your error conditions in your test
plan.
>
>
>
> DELIVERABLES
>
>
>
> 1. A disk of the source code of the program pg2 and all included files.
>
> 2. Hard copy of a listing of your implemented test plan.
>
> 3. Hard copy of the output file, "receipts.out", produced by running your
program using the input
>
> specified in your test plan.
>
>
>
>
>
> --------------------------------------------------------------------------
------
> Send and receive Hotmail on your mobile device: Click Here
> _______________________________________________ Dev-cpp-users mailing list
Dev...@li...
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|