0

i am trying to solve that assignment and this is what i have so far

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CarInsurance
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            int driverAge;
            String stRes = "WI";
            const int BASEIL = 100;
            const int BASEWI = 50;
           

            try
            {
                driverAge = Convert.ToInt32(textBox1);
                stRes = Convert.ToString(textBox2);
                if (driverAge < 16 &&  driverAge > 80 || stRes != "WI" && stRes != "IL" )
                
                driverAge = (3*100) - driverAge;

            }
            catch (ArgumentException)
            {
                label3.Text = " ";
            
            }

            try
            {
                if(driverAge != "" )


            }

            catch(FormatException)
            {
                label3.Text = "Error":
            }
                

        }

        private void button1_Click(object sender, EventArgs e)
        {


        }
    }
}
Attachments Screen_shot_2011-04-16_at_10.07_.10_AM_.png 75.65 KB
2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by pseudorandom21
0

I think it means you need to create a separate class named "CarInsurance" as per your instructions, and all it has in it is the two variables, and the function.

It will need to "throw" from inside the function, an ArgumentException, using "throw".

http://msdn.microsoft.com/en-us/library/1ah5wsex(v=vs.80).aspx
http://msdn.microsoft.com/en-us/library/system.argumentexception.aspx
:

throw new ArgumentException("Some error message", "someParamter");

Edited by pseudorandom21: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.