You will create a Windows Forms Application.
The form will contain the following:
- Text boxes to enter two imaginary numbers. Each imaginary number will be made of two text boxes. One text will contain the real part of the number. A second text box will contain the imaginary part of the number.
- A label box. It will contain the answer to a mathematical calculation for the two imaginary numbers entered in the text boxes.
- Two radio buttons (i.e., one for addition and one for subtraction). The addition button will be selected automatically when the form is initialized.
- Two buttons.
- One button will be titled Calculate and will cause the calculation to be performed based on the selection of the radio buttons.
- The other button will be titled Exit and will cause the application to end.
- Two additional classes.
- The first class will be called Real Number and will contain one integer variable that should represent the real number portion of the imaginary number. This class should have appropriate constructors, getters, and setters.
- The second class should extend the RealNumber class, and it should be called ImaginaryNumber. This class should contain one integer variable to represent the imaginary number portion of the imaginary number. For the ImaginaryNumber class, override the addition and subtract operations.
- Place an appropriate title on the form and provide descriptive names for all variables.
- The program should allow the user to enter two imaginary numbers and display the answer to the arithmetic operation specified by the radio buttons.
In this lesson, you will be adding to the classes you created last week.
- Create an IEquatible interface that defines an Equals method.
- Add two radio buttons: one for ++ and one for --
- Overload the ++ and - operator to add or subtract 1 from the real portion of the number
You will use exception-handling techniques to catch and handle exceptions
Implement try/catch blocks to complete the following:
- Check for errors when required text boxes are left unchecked.
- Check for invalid data (e.g., numbers) being placed into a text box.
- Put all of the text boxes, radio buttons, and buttons in a logical tab order.
Create a console program that implements a linked list as a last in first out queue (LIFO). The linked list should be created as follows:
- Be in a class by itself and should take any type of data type.
- Contain an iterator to allow users the ability to traverse the list.
- Contain a remove method to return and remove the first item in the list.
You will use file streams to create and manage the data in the files.
Create two console applications as follows:
- The first application should create a text file and save information for three students. That information should be as follows:
- The second program should read the first file and display the stored information.
NOTE: Both files should query the user for the name and directory where the file is to be saved.
1. In your opinion, is it better to specify protected access modifiers for data in a super class, to specify subclass access, or require the subclass to use the public methods of the super class? Explain your answer.
2. Explain the difference between public, protected, and private access specifiers.
3. In your opinion, would implementing multiple inheritance be a better choice than using the C# standard interfaces? Justify your answer.
4. Explain what function an interface performs. How is it implemented? What requirements does an interface impose on the class that implements it?
5. There are two main methods of dealing with exceptions. One approach is to use if statements. The other is to use the try/catch blocks provided in main OO design implementations. In your opinion, what is the best approach? Explain your response.
6. You are planning to use try/catch blocks for error detection. How can you be sure that problems you did not anticipate will be caught by your try catch blocks?
7. You have used arrays in previous classes. In your opinion, is it possible to resize an array while the program is executing? Justify your answer.
8. Describe the advantages of a linked list over an array.
9. In your opinion, would the ability to create a program to generate test data speed up development? Consider the case where the same data is used in multiple programs. Justify your response.
10. Explain the modes for opening file streams in C#.