We will be implementing an application that allows adding and searching for insurance policies We define the necessary properties, constructor and a ToString method that shows “Insurance Details"
INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS
Part I
We will be implementing an application that allows adding and searching for insurance policies.
Question 1: [15 pts]
We start by creating an “Insurance” class that has the following properties:
- Type : string
- Customer : string
- Phone : string
- PolicyAmount : int
- Years : int
We define the necessary properties, constructor and a ToString method that shows “Insurance Details: Type,Customer,Phone,Total" where Total=PolicyAmount*Years.
Question 2 – New Insurance [35 pts]:
When the application starts, it shows a Groupbox containing the below controls:
- Five Labels
- A combo box for the policy type which can be: Medical, Life or Car
- Two textboxes for the customer name and phone. The phone text box allows entering digits only.
- Two numericupdown controls for the policy amount and number of years.
- Policy amount ranges between 1000 and 10000, the increment step is 200 [3pts]
- Number of Years5 ranges between 1 and 5, the increment step is 1 [2pts].
- Two buttons to add a policy and for searching.
When the form first loads, the combo box for the policy type will be filled with three options: Medical, Life and Car.
The “Search” button is initially disabled, until the user fills the first policy. Then it becomes enabled.
If the user clicks the “Add Policy” button without filling the necessary fields or in case the phone number had more or less than 8 digits, you can use the Length property of strings to test, the below message will be displayed
If all the entries are valid, a new Insurance policy object is created and added to an array list of type “Insurance”.
Write the necessary code to:
- Load the combo box with the 3 type values. [5pts]
- Allow only digit inputs in the phone text box [5pts]
- Validate the entries [5pts]
- Add a new policy when the button Add is clicked, clear and reset all fields. [10 pts]
- Enable the search button after the first policy and upon clicking the button Search the Groupbox “Search Area” becomes visible as shown in the figure below [5 pts]
Question 3 – Search Area [50 pts]
The Search Area groupbox consists of:
- One label : « Search By ? »
- Two radio buttons
- A textbox
- Three buttons
- A listbox to show the results
You can implement the code using LINQ queries or the Query Methods and Lambda Expressions.
If the user clicks on the button “Go” without selecting any radio button or entering a filtering value in the text box, a message is displayed as shown below:
If the user selected “Type”, this means that he will be searching for policies by the type entered in the textbox. If the user selected “Customer”, then he will be looking for the policies belonging to a customer with a name containing the value entered by the user. The results are to be displayed in the listbox.
Hints:
- When comparing between two strings, to avoid a mismatch because of the cases: Medical and medical for example, we can convert both to lower before testing:
- String x=”Medical”, y=”medical”;
- ToLower().Equals(y.ToLower()) à returns true.
- Contains method can be used with Strings to test if a string is a substring of another. “Rami Kady”.ToLower().Contains(“rami”.ToLower()) à yes
- Implement the « Go » button as explained [20 pts].
- The button with text: Customers who bought a policy for more than 2 years, will show in the list box, the customer names only for those who have a Years property > 2. Write the necessary code [15 pts]
- The last button shows in the listbox the most expensive policy, that is the one that has the highest total cost: PolicyAmount * Years. Write the necessary code. [15 pts]
Attachments:
Related Questions
. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C
DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma
. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an
Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t
. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual
Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:
1
Project 1
Introduction - the SeaPort Project series
For this set of projects for the course, we wish to simulate some of the aspects of a number of
. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:
1
Project 2
Introduction - the SeaPort Project series
For this set of projects for the course, we wish to simulate some of the aspects of a number of