cpp program for shopper how?

Write your question here.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
  Project Overview
The owner of a small shop selling books, magazines and movie DVDs wishes to set up a
shopping kiosk at MMU. Two programs are needed for the kiosk. The first program is a
program for the shop owner to manage shop items and the second program is a program
for shoppers to place orders and make payment at the kiosk. The items ordered will then
be sent to the addresses specified by the shoppers. Both programs will run in a personal
computer embedded inside the kiosk.
\
The Program for Shoppers
This program is used by shoppers to shop at the kiosk. A shopper first needs to register at
the kiosk by keying in
- his/her name,
- full address (treat this as one string object),
- customer type (assume the shopper selects the correct type truthfully) and
- password (a shopper logs in using his/her customer id and a password)
Customer id’s are auto generated by the program.
There are three customer types. They are normal customer, MMU student and MMU
staff. An MMU student needs to provide information about his/her major and an MMU
staff needs to state the name of the department where he/she works at.
After registering, a shopper can use this program to shop for items. The program will
allow the shopper to view items and add, delete and modify items in his/her shopping
cart. He/she can also view his/her shopping records and delete past shopping records if
he/she wishes to. In addition, the shopper can update his/her profile information and
deregister himself/herself.
When a shopper checks out, the shopper only needs to enter his/her payment card number
(assume this is a 10 digit number) to make payment.
Technical requirements
Implement two programs with easy to use user interfaces to facilitate the features
described above. The programs have to be written in standard C++ code using only
standard libraries. They have to be executable on any platform which supports standard
C++.
Ask for login user name and password before allowing a shopper or the owner to use a
program. The password can be stored in plain text without encryption.
Implement an abstract class called Shopper and three classes, Customer, MMUStudent
and MMUStaff as its subclasses. The function to display a shopper's profile is to be
coded as a pure virtual function in Shopper.
Implement an abstract class called ShopItem and three classes, Book, Magazine and
Movie as its subclasses. The function to display a shop item is to be coded as a pure
virtual function in ShopItem.
Use dynamic (late) binding when possible to display shopper profiles and shop items.
Every class must have a default constructor. If a class has a dynamically allocated data
member, implement a copy constructor and a destructor for the class. If needed, overload
the assignment operator ( operator=() ) for the class.
Use text files to store data entered by the manager, the profile data entered by shoppers
and other pieces of information needed by the two programs. Sales data should be stored
in its own text file. The recommended text file schema is as shown below. The schema
follows the common practice used in relational data modelling for a many-to-many
relationship.
|----------+-------------+--------------+-----------------|
| sales id | customer id | shop item id | number of units |
|----------+-------------+--------------+-----------------|
| 1 | 1 | 12 | 3 |
| 1 | 1 | 10 | 4 |
| 2 | 1 | 5 | 1 |
| 2 | 1 | 1 | 1 |
| 3 | 2 | 12 | 5 |
|----------+-------------+--------------+-----------------| 
you forgot to post the code and which part was giving you trouble?
Hello aliez,

This will help in understanding the tags: http://www.cplusplus.com/articles/z13hAqkS/

I hope your first post is not an indication of what your code will look like because it gave me a headache trying to figure it out.

This should help:

                               Project Overview

The owner of a small shop selling books, magazines and movie DVDs wishes to set up a
shopping kiosk at MMU.

Two programs are needed for the kiosk.

The first program is a program for the shop owner to manage shop items and the second program is a program
for shoppers to place orders and make payment at the kiosk. The items ordered will then
be sent to the addresses specified by the shoppers.

Both programs will run in a personal computer embedded inside the kiosk.

\

The Program for Shoppers
This program is used by shoppers to shop at the kiosk.

 • 4. A shopper first needs to register at
the kiosk by keying in

 • 4a - his/her name,
 • 4b - full address (treat this as one string object),
 • 4c - customer type (assume the shopper selects the correct type truthfully) and
 • 4d - password (a shopper logs in using his/her customer id and a password)

 • 5. Customer id’s are auto generated by the program.
   • 5a. There are three customer types. They are normal customer, MMU student and MMU staff.

An MMU student needs to provide information about his/her major and an MMU
staff needs to state the name of the department where he/she works at.

After registering, a shopper can use this program to shop for items.

The program will allow the shopper to view items and add, delete and modify items in his/her shopping
cart.

He/she can also view his/her shopping records and delete past shopping records if he/she wishes to.

In addition, the shopper can update his/her profile information and deregister himself/herself.

When a shopper checks out, the shopper only needs to enter his/her payment card number
(assume this is a 10 digit number) to make payment.

Technical requirements
Implement two programs with easy to use user interfaces to facilitate the features
described above.

The programs have to be written in standard C++ code using only standard libraries.

They have to be executable on any platform which supports standard C++.

Ask for login user name and password before allowing a shopper or the owner to use a
program.

The password can be stored in plain text without encryption.

 • 1. Implement an abstract class called Shopper and three classes, Customer, MMUStudent
and MMUStaff as its subclasses.

 • 2. The function to display a shopper's profile is to be coded as a pure virtual function in Shopper.

 • 3. Implement an abstract class called ShopItem and three classes, Book, Magazine and
      Movie as its subclasses.

The function to display a shop item is to be coded as a pure virtual function in ShopItem.

Use dynamic (late) binding when possible to display shopper profiles and shop items.

Every class must have a default constructor.
If a class has a dynamically allocated data member, implement a copy constructor and a destructor for the class.

If needed, overload the assignment operator ( operator=() ) for the class.

Use text files to store data entered by the manager, the profile data entered by shoppers
and other pieces of information needed by the two programs.

Sales data should be stored in its own text file.

The recommended text file schema is as shown below.

The schema follows the common practice used in relational data modelling for a many-to-many
relationship.

|----------+-------------+--------------+-----------------|
| sales id | customer id | shop item id | number of units |
|----------+-------------+--------------+-----------------|
| 1 | 1 | 12 | 3 |
| 1 | 1 | 10 | 4 |
| 2 | 1 | 5 | 1 |
| 2 | 1 | 1 | 1 |
| 3 | 2 | 12 | 5 |
|----------+-------------+--------------+-----------------|


I gave some parts numbers as to what to do first. If you write the program a little at a time, compile often to fix any problems and test as often as needed it really helps.

It would also help to take a piece of paper and plan the program. You could use pseudo code, a flow chart or some other way to get an idea what needs to be done. This will depend on what you have learned.

Start with your classes and make sure they work first. Once you can store the information in the classes it will make the rest of the program easier to write.

Andy
Topic archived. No new replies allowed.