Click here to Skip to main content
15,912,069 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to print out a character Pin
Cuu6-Nov-04 10:38
Cuu6-Nov-04 10:38 
AnswerRe: How to print out a character Pin
faroqtam6-Nov-04 12:36
faroqtam6-Nov-04 12:36 
GeneralRe: How to print out a character Pin
Cuu8-Nov-04 15:15
Cuu8-Nov-04 15:15 
AnswerRe: How to print out a character Pin
ThatsAlok6-Nov-04 17:28
ThatsAlok6-Nov-04 17:28 
GeneralRe: How to print out a character Pin
Cuu8-Nov-04 15:16
Cuu8-Nov-04 15:16 
GeneralRe: How to print out a character Pin
ThatsAlok8-Nov-04 18:24
ThatsAlok8-Nov-04 18:24 
AnswerRe: How to print out a character Pin
David Crow8-Nov-04 5:24
David Crow8-Nov-04 5:24 
Generali need help plzzzz my first time to use classes Pin
Member 13942596-Nov-04 9:19
Member 13942596-Nov-04 9:19 
*first time to use classes and i need help to do this plz*
Imagine that you are ready to go shopping. You remember your list of items to buy, place some money in your wallet, and off you go. Once you have parked the car away from the loose carts in the lot, you stroll into the store, grab a cart of your own, and head toward your listed items. When you have finished selecting your stuff, you find the shortest checkout line. What happens next? You wheel the cart into the checkout area, and the clerk removes the items one at a time and scans them through the register. The clerk tells you the total cost of your purchases. You reach into your wallet and (assuming you have enough money) give the clerk the balance due, get the bags, and leave the store.

Now we need to think about a program design that models this shopping scenario. What are all the real-world objects? There is a shopper. There is a checkout clerk. The shopper has a wallet. There is also a shopping cart. And there are items that the shopper wants to buy.

How are all these objects related? The shopper has a wallet. The shopper interacts with (uses a) checkout clerk. These relationships are fairly obvious. However, the relationship between the shopper and the shopping cart is not so clear. (Remember, in a has a relationship, the object is an integral part of the containing object, whereas in the uses a relationship, the second object provides a service to the first object.) The shopper uses a cart (true enough). We can argue that the shopper must carry his or her items and the cart does this task for the shopper; therefore, the cart is an integral part of the shopper.

The Cart class can now be started. Assuming a Cart object is capable of holding up to 10 Items. The software cart also needs to keep track of how many items it contains and to have the ability to add an item into the stuff array. Also, because the data is private, we need to access the array of items. The cart should be smart enough to calculate the price of the items it holds at any point of time. Shoppers can add or return items out of his shopping carte before he checks out.

Shopper reads the items from a data file called StuffToBuy.dat. This file contains the item name, price, and quantity.
For example, our Shopper might have a list that looks like the one here:
whole wheat bread 1.99 2
vanilla Ice cream 4.59 1
honey 2.69 1
apples 0.25 6
decaf coffee 5.99 1

When the items are placed in the Cart and checked out, each item (whether the Shopper purchased one or many) is treated as a single item. Add the ability for the Clerk to report the item name and price as the items are scanned during the checkout procedure. Also, have the Clerk add a 5 percent sales tax to the total purchase amount and report the number of items scanned. The Shopper should write out the amount of money in his or her wallet before and after the shopping experience. Clerk should be able to calculate the total amount he has at any point of time and should be able to check the store’s stock at any point of time as well.

GeneralRe: i need help plzzzz my first time to use classes Pin
Christian Graus6-Nov-04 9:27
protectorChristian Graus6-Nov-04 9:27 
GeneralRe: i need help plzzzz my first time to use classes Pin
Member 13942596-Nov-04 10:39
Member 13942596-Nov-04 10:39 
GeneralRe: i need help plzzzz my first time to use classes Pin
6-Nov-04 10:44
suss6-Nov-04 10:44 
Generalpopular Java forums Pin
includeh106-Nov-04 8:08
includeh106-Nov-04 8:08 
GeneralWindow Restore Pin
Leyu6-Nov-04 8:02
Leyu6-Nov-04 8:02 
GeneralRe: Window Restore Pin
Neville Franks6-Nov-04 10:19
Neville Franks6-Nov-04 10:19 
GeneralWin32 Pin
Daniel Kanev6-Nov-04 4:33
Daniel Kanev6-Nov-04 4:33 
GeneralRe: Win32 Pin
DavidNohejl6-Nov-04 6:11
DavidNohejl6-Nov-04 6:11 
GeneralAnnonying popping sound Pin
Mathias S.6-Nov-04 3:03
Mathias S.6-Nov-04 3:03 
GeneralProtecting text in a CRichEditCtrl Pin
dlarkin776-Nov-04 2:22
dlarkin776-Nov-04 2:22 
GeneralRe: Protecting text in a CRichEditCtrl Pin
David Crow8-Nov-04 5:30
David Crow8-Nov-04 5:30 
GeneralLoading Image given parent handle Pin
dharani6-Nov-04 0:26
dharani6-Nov-04 0:26 
GeneralRe: Loading Image given parent handle Pin
faroqtam6-Nov-04 12:31
faroqtam6-Nov-04 12:31 
GeneralRe: Loading Image given parent handle Pin
dharani7-Nov-04 17:16
dharani7-Nov-04 17:16 
GeneralRe: Loading Image given parent handle Pin
Anonymous7-Nov-04 17:57
Anonymous7-Nov-04 17:57 
Generalcreating a random number with uniform distribution Pin
seyirdefteri6-Nov-04 0:20
seyirdefteri6-Nov-04 0:20 
GeneralRe: creating a random number with uniform distribution Pin
David Crow8-Nov-04 5:34
David Crow8-Nov-04 5:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.