Sei sulla pagina 1di 2

THE HONG KONG POLYTECHNIC UNIVERSITY

Computer Programming (ENG236) 2011/2012 Assignment 3


A. Instructions
1. You should submit one compressed file with the name as ZZxxxxxxxx file (where xxxxxxxx is your student ID number and
ZZ is your major: EE, TS or HD) which contains the folder of your C++ project (you must delete the files with the
extension of .ncb or .sdf before compressing the project folder) on or before 19 Mar 2012. You may submit your work
to YK via email: eeykmok@inet.polyu.edu.hk. Marks will be deducted for each day submission delayed.
2. Your name and student id should be stated at the top of main form file, e.g. Form1.h.
3. Plagiarism is considered as a serious offence in the University. Some students had been found plagiarism in assignment 1
and finally got marks deduction. Starting from this assignment, the one who copies the source codes from others and the
one who offers the source codes will also get zero mark and the case may be reported to faculty/department for further
consideration.

B. The Programming Task


To develop a Windows Forms application, it implements a customer information system. Each record contains: Honorifics
(Ms, Mr, Mrs), Name, Phone (8 numbers, not starting with zero), total Amount of purchase (greater than zero), and member
class: Silver (<$3000), Gold(<$6000), Platinum(<$9000) and Diamond. It opens a text file, bookstore.txt, by native C++
<fstream> command and the format must be followed as below fig. 12. The program has the functions: 1. Read and write
data file, 2. Add and edit record, 3. List records, 4. Delete record and contains 3 WinForms normally. It starts as fig.1 in
which the bookstore.txt should be default. The features and functions of the following screens must be followed.

fig. 1

fig. 2

fig. 3

fig. 4

fig. 5

fig. 6

fig. 7

fig. 8

fig. 9

fig.10

fig.11

fig.12

Guidelines:

If the data file cant be opened, show a message of dialogue box e.g. fig.11. After reading in data from the file, the
open button disappeared and the filename cant be changed (the textbox becomes grey color).

The button Exit is the only way in the program to exit.

Only one radio button can be selected and the corresponding options appear. Alert message will be shown when
button Go clicked but no radio button is selected. Input of phone number for searching should be checked: 8 digits
only and not starting with zero. Clicking the button Take All will check all 4 checkboxes.

Two appeared forms fig.6 and fig.7 are modal forms.

When the button Go is clicked with one of the first 3 radio buttons is selected, this form should be hidden and another
form as fig. 7 appears.

For searching selection, after searching record displayed, all information cant be changed at the moment (the textbox
is in grey color).

Back button will close the current form and go to the form as fig.2. The total no. of records will be updated.

When the button New Purchase is clicked, new entry is shown as fig. 8. Cancel button discards the input and back to
fig.7. Update button will check the input amount first which is floating-point allowed number greater than zero. Handle
the input of characters to avoid this program failed. Add the input with the current amount and change the class if the
amount meets the range. Save this record to the data file. Go back fig.7 and show the new value of amount and class.

When the button Edit Info. is clicked, honorifics, name and phone can now be changed. Update button will check the
phone data, save the information to the data file and go back fig.7 showing the updated information.

When the button Delete Rec. is clicked, a message is shown as fig.11. Cancel button discard the action and go back
fig.7. OK button will delete the record from the data file and then go back fig.7, update the total no. of records at the
top of the form and show the information of next record.

When adding new customer, the form as fig.10 is shown. A drop down list of Ms, Mr and Mrs should be provided for
selection. Add+Save button will check: one of Ms, Mr and Mrs selected, name is not empty, correct input of phone and
purchased amount as stated in above guidelines. Find out the corresponding class. Add and write this record to the
data file. Go back fig.7, update the total no. of records at the top of the form and show this new information.

Potrebbero piacerti anche