You are on page 1of 2

THE HONG KONG POLYTECHNIC UNIVERSITY

Computer Programming (ENG236) 2010/2011 Assignment 3


A. Instructions
1.

2.
3.

You should submit your work to YK in one compressed file with the name of your student ID via email:
eeykmok@inet.polyu.edu.hk on or before 18 Mar 2011 and then you must make one appointment with
YK to discuss your work before obtaining your grade. Marks will be deducted for each day submission
delayed (the discussion can be arranged after the deadline).
Your name and student id should be stated at the top of Form1.h file.
Your programs need to be well commented and have a good structure. Lacking comments will result in
down-grading.

B. The Programming Task


Develop a Windows Forms Application by creating a new project named xxxxxxxx in a new folder named xxxxxxxxas3
where xxxxxxxx is your student id. You should delete file(s) with extension .sdf and compressed the folder before submission.
1. Create a Form as follows:

Figure 1.
2.

Implement the actions:


Save(on menu-bar): Save the input information and the selected item(s) to file(s). You may design the file format but the
information should be readable (e.g. contains the item names). Before saving, check:
o The ID has four digit starting from 1000, otherwise, display a message box:

Once the OK button clicked, the text of ID should be cleared

o
o
o

If the quantity of a item is not entered or not greater than zero, this item will be ignored (you may put none as the
item and quantity to be zero in the file)
You must use native C++ unmanaged code <fstream> to manipulate the file
After successfully save the file, display a message box with the input Name:

o Once the OK button clicked, all entered information should be cleared


Exit(on menu-bar): Close the form/window
Get ID record button: Retrieve the purchasing information of the ID entered, like:

(hint: radioButton1->Checked = true; //this changes the radio-button 1 being selected)


Space in the input text for Name field should be allowed
Only ONE radio-button can be selected for each row of item. Once a radio-button is selected, the corresponding price should
be shown after Each Price (HK$) label and the price after Total Price -> button should be hidden (e.g. in the above
diagram, HK$ 1400 will be disappeared when radio-button Clock is clicked). The each price is as follows:
o Clock: 180.00, Watch: 200.00, Timer: 220.00, Alarm: 250.00
o Baseball: 200.00, Volleyball: 250.00, Football: 300.00, Basketball: 350.00
o Mizuno: 150.00, Puma: 180.00, Addidas: 200.00, Nike: 250.00
Total Price -> button: Calculate the sum of all item(s) price and display the sum. If the number for the Quantity field is not
greater than zero or not entered, just neglect the item.
Clear All button: Clear all entered information (display the form as Figure 1)

You might also like