Question

In: Computer Science

WPF application that calculates insurance rates using complex conditional statements. Include the ability to enter the...

WPF application that calculates insurance rates using complex conditional statements.

Include the ability to enter the gender and age and click a button to calculate the insurance rate.

C#

Solutions

Expert Solution

Step 1 : open a new WPF Application. Name it as InsuranceCalculator.wpf

Step 2: Go to the Form window and Layout

Step: Create Labels and buttons as required

Label1.txt = "Please Enter the insurance amount"

Textbox1.txt = value entered by user

Label2.txt = "Please Enter the age"

Textbox2.txt = age

Lablel3.txt = " Please Enter the gender"

textbox3.txt = gender

Button1.txt = Calculate

Button2.txt = Cancel

C# code to be written as given below

using System;   

using System.Windows;   

using System.Windows.Controls;   

  

namespace MyCalculatorv1   

{   

public partial class MainWindow : Window   

{   

public MainWindow()   

{   

InitializeComponent();   

}   

  

private void Button_Click_1(object sender, RoutedEventArgs e)   

{   

Button b = (Button) sender;   

tb.Text += b.Content.ToString();   

}   

  

private void Result_click(object sender, RoutedEventArgs e)   

{   

try   

{   

calculatePremium(p);   

}   

catch (Exception ex1)   

{   

tb.Text = "Your Result is displayed";   

}   

}   

private void Button_Click_2(object sender, RoutedEventArgs e)   

{   

Button b2 = (Button) sender;   

tb2.Text += b2.Content.ToString();   

}   

  

private void Result_click2(object sender, RoutedEventArgs e)   

{   

try   

{   

calculatePremium(p);   

}   

catch (Exception ex2)   

{   

tb2.Text = "Please Enter the value again!";   

}   

}   

public double calculatePremium(Person person) {

// Added base premium

double premium = 5000;

// Increase premium depending on age

if (person.getAge() >= 18) {

premium *= 1.1;

}

if (person.getAge() >= 25) {

premium *= 1.1;

}

if (person.getAge() >= 30) {

premium *= 1.1;

}

if (person.getAge() >= 35) {

premium *= 1.1;

}

if (person.getAge() >= 40) {

// Add 20% per 5 years above 40

int age = person.getAge() - 40;

while (age >= 5) {

premium *= 1.2;

age -= 5;

}

}

// Add gender specific adjustments

if (person.getGender() == Gender.MALE) {

premium *= 1.02;

}

}

  

}

}

return premium;

}

  

private void Off_Click_1(object sender, RoutedEventArgs e)   

{   

Application.Current.Shutdown();   

}   

  

private void Del_Click(object sender, RoutedEventArgs e)   

{   

tb.Text = "";   

}   

  

private void R_Click(object sender, RoutedEventArgs e)   

{   

if (tb.Text.Length > 0)   

{   

tb.Text = tb.Text.Substring(0, tb.Text.Length - 1);   

}   

}   

}   

}   


Related Solutions

Using C++, Right down a code that calculates insuranceprice:* requires driver to enter their...
Using C++, Right down a code that calculates insurance price:* requires driver to enter their age and the amounts of accidents they have hadbased on that:*base price is $500*additional fees of $100 if driver is younger than 25*additional fees based on accidents:number of accidentsfees of accidents15021253225437555756 or moreno insurance*Use switch*if had 6 or more accidents won't be able to get insurance
***IN C# ONLY, USING WINDOWS FORMS*** --NO JAVA--. Create a GUI application in C# that calculates...
***IN C# ONLY, USING WINDOWS FORMS*** --NO JAVA--. Create a GUI application in C# that calculates and displays the total travel expenses of a business person on a trip. Here is the information that the user must provide: • Number of days on the trip • Amount of airfare, if any • Amount of car rental fees, if any • Number of miles driven, if a private vehicle was used • Amount of parking fees, if any • Amount of...
Identify the false statements. I. The ability to use the cashvalue of a life insurance...
Identify the false statements. I. The ability to use the cash value of a life insurance policy to purchase paid-up term insurance is referred to as a non-forfeiture option. II. The premium for $100,000 of 20-year term insurance will be lower than for 5-year term insurance. III. At a certain age, term insurance can no longer be renewed. IV. Term insurance policies can either be participating or non-participating. V. The premium of term-to-100 insurance rises over time. VI. The premiums...
// Assignment06.cpp : Defines the entry point for the console application. // #include #include using namespace...
// Assignment06.cpp : Defines the entry point for the console application. // #include #include using namespace std; int main() { string s = "this is a test, this is also a test, this is yet another test"; int strLen = 0; strLen = s.length(); // code will go here cout << s << endl; return 0; } Add code to capitalize all of the lowercase ‘t’s. The problem may be simple, but the solution may be a bit tricky.
What regulations limit or enhance the insurer's ability to establish fair and accurate insurance rates and premiums for insureds?
Premium AuditingExamine the rating classes applied to the accounts that you audit.What regulations limit or enhance the insurer's ability to establish fair and accurate insurance rates and premiums for insureds?
Using the conditional assignment statements, write the verilog code for 16:1 Mux. Write the test bench...
Using the conditional assignment statements, write the verilog code for 16:1 Mux. Write the test bench for this module.
Write a program in c++ using only if statements that prompts the user to enter an...
Write a program in c++ using only if statements that prompts the user to enter an integer for today’s day of the week (Sunday is 0, Monday is 1 …., and Saturday is 6) then displays today. Also, prompt the user to enter the number of days after today for a future day and display the future day of the week. The future day can be computed as follows: (today + number of days after today) % 7 Sample run...
How to solve using functions in TI84: In order to set rates, an insurance company is...
How to solve using functions in TI84: In order to set rates, an insurance company is trying to estimate the number of sick days that full time workers at an auto repair shop take per year. A previous study indicated that the standard deviation was 2.8 days. How large a sample must be selected if the company wants to be 95% confident that the true mean differs from the sample mean by no more than 1 day? A)141 B)31 C)1024...
Using NetBeans IDE, write a JavaFX application that allows theuser to choose insurance options. Use...
Using NetBeans IDE, write a JavaFX application that allows the user to choose insurance options. Use a ToggleGroup to allow the user to select only one of two insurance types—HMO (health maintenance organization) or PPO (preferred provider organization). Use CheckBoxes for dental insurance and vision insurance options; the user can select one option, both options, or neither option. As the user selects each option, display its name and price in a text field; the HMO costs $200 per month, the...
compare the financial statements effects of using historical as opposed to current rates of exchange as...
compare the financial statements effects of using historical as opposed to current rates of exchange as foreign currency translation coefficients
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT