Write a program to allow the user to enter a series of


Problem description

Write a program to allow the user to enter a series of lines for a calculation using the numeric keypad. The Program should show what the user has entered and allow the user to modify, print and save their work.

Requirements Part 1: Program structure

1. The program will have the fallowing three classes:
• A class for the main form named AddStripForm
• A CalcLine class to handle the requirements for individual lines in the calculation this class will be supplied lo you and is to be added to your project and used as provided.
• A Calculation class to handle the requirement for the calculation as a whole.

2. Detailed requirements for the calculation class.
Private data members
• The following data member is used to store the CalcLine objects that make up the lines of the calculation:
Array List theCalcs;
• The following data members holds a reference to a list box component on the main form so that the data in the calculation object can be displayed in the listbox.
ListBox lstdisplay;
Requirements Part 2: Interface behaviour and data processing

3. Data entry
• The user will enter data in the top textbox.
• The first character may be +, - or the Enter key (if the program has just started and no calculations have begun then the Enter key should not be allowed).
• The characters immediately following the first character must be numeric.
• The terminating character in a line can be +, -, *, /, #, = or the Enter key.
• The program will respond to the terminating character in a line by creating a new CalcLine object using the text in the line so far and adding this object to the Calculation object.
• When the terminating character is one of +. -, *, / then the Terminating character will be the first character in the new entry, eg. if the textbox contains +123 and the user pressers the / key the line +123 will be added to the calculation and the textbox will change to contain just the / character.
• If the terminating character is #, add a new CalcLine object for a subtotal of the calculation.
• If the terminating character is = or the Enter key, add a new CalcLine object for a total to the calculation.

4. When the program is run it will have the following appearance on the screen (see end of document for other examples):

5. Editing the files of the calculation
• If the listbox is clicked, the text From the -clicked line will show in the bottom textbox unless the line is for subtotal or a total, in which case # or = will show in the bottom textbox.
• When the [Update] or [Insert] buttons are clicked, check that the text in the bottom textbox does not break the rulers for a calculation line.
• If the user clicks [Update], the text in the bottom textbox will replace the currently selected line in the listbox. Do this by creating a CalcLine object from the text and using this new CalcLine object to replace the existing Calcline object in the Calculation's ArrayList. (Updating the listbox will follow automatically from this if the Calculation class has been correctly implemented.)
• If the user clicks [Delete] the program will ask the user wants to delete the selected line and if the user responds Yes then the selected line will a removed. Do this by removing the matching CalcLine object from the Calculation's ArrayList (Uplating the listbox will fallow automatically from this if the Calculation class has been correctly implemented.)
• IF the user clicks [Inset] the program will insert a new line in the calculation immediately before the selected line. Do this by creating a CalcLine object from the text and inserting this new CalcLine object in the Calculation's ArrayList. (Updating the listbox will follow automatically from this if the Calculation class has been correctly implemented.)

6. The file menu will offer the following options:
• New-starts a pew calculation and displays a blank listbox and blank text boxes.
• Open - displays an 0penDialog Box and lets the user pick a previously created .cal file. The data in the file is read and used to create a new Calculation object and display its calculation lines.
• Save - if the 'Adding strip' data has not been sawed before, Save runs the Save As option. II the `Ad-ling strip' data is for an 'misting `Adding strip' data filer the data in the Calculation object is saved back to that file without displaying a SaveDialogBox.
• Save As -displays a SaveDialogBox with either the name of the opened file or if it is a new rile being saved, gives a default name 'Calculation1 .cal' . The data in the Calculation object is saved as a text file using the filename the user chooses.
• Print - prints the lines of the calculation object using print preview form to display the printout first and then print if the user chooses to do so.
• Exit - closes the program

7. By default the text file holding the `Adding strip' data will be stored in the 'C:\temp folder on C:drive. This is to be the initial directory of the Open and Save dialogs.

8. The `Adding strip' data files will have a file extension .cal'. This will be used in the Filter and Default extension settings for the Open and save dialogs.

9. The program will detect if the user has made changes after a file is opened, a new fie is created or a file is saved. If there are changes, the user will be given a chance to save their changes before any action takes place that would lose the changes. These actions are New, Open, and Exiting via the menu or closing the main form via the [X] button in the title bar.

10. The program will read data from and save data to tee files assuming the following format:
An operator character, a space and text representing a decimal number unless the operator is # or = in which case there is no fallowing number.
Example:
+1
+2
+3
#
+4
+5
*10
=

Required Tests
This is the minimum number of test cases you need in your testing documentation:
1. Interface displayed correctly when the program runs
2. A simple single operator calculation that handles invalid characters and operations
3. A new calculation can be started
4. An existing fie can be opened
5. A calculation can be saved
6. A calculation can tie sawed as another file
7. A calculation can be printed
8. The program ca n be exited
9. A line can be deleted from a calculation
10. A line can be updated in a calculation
11. A line can be inserted into a calculation
12. Check that Test. files, extension .cal and C:\Temp\ is the default folder
13. A calculation that includes an addition (+) may
14. A calculation that includes a Subtraction (-) only
15. A calculation that includes a Division (/) may
16. A calculation that includes a multiplication (*) only
17. A calculation that includes an addition, a subtraction, a division, a multiplication and a total
18. A calculation that includes a Sub-total and a total
19. A calculation that includes a Total (resell to zero)
20. A calculation that includes 8 operators, 2 sub-totals and a total
21. The user is warned about unsaved data when closing the form.
Please note that your tests can involve more than one step and must be reproducible (i. e explicit test data and user actions) and independent of each other (i.e. please do not use the Output of one test as the input to another test)

Attachment:- Project.rar

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Write a program to allow the user to enter a series of
Reference No:- TGS02801791

Expected delivery within 24 Hours