Question

In Microsoft Visual Studio (C#): An Internet service provider offers four subscription packages to its customers,...

In Microsoft Visual Studio (C#):

An Internet service provider offers four subscription packages to its customers, plus a discount for nonprofit organizations:

Package A: 10 hours of access for $12.95 per month.  Additional hours are $4.00 per hour.

Package B: 20 hours of access for $14.95 per month.  Additional hours are $2.00 per hour.

Package C: 30 hours of access for $20 per month.  Additional hours are $1.00 per hour.

Package D: Unlimited access for $35.95 per month.

A nonprofit organizations will get 20% discount on all packages.

The user should select the package the customer has purchased from a set of radio buttons and enter the number of hours used in a textbox.  A check box captioned “Nonprofit organization” should appear on the form.  The application should calculate and display the total amount due with a textbox.

Input validation: The number of hours used in a month must contain digits only and cannot exceed 744.  You must use Validating event to do the validation.

Test your program with these data:

a. Package B using 25 hours, not non-profit: cost: $24.95

b. Package C using 40 hours, is non-profit: cost;$24

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Design:

code:

using System;
using System.Windows.Forms;

namespace InternetProvider
{
    public partial class Form1 : Form
    {
        double NonProfitDiscount,price,total;
        int hours;

        public Form1()
        {
            InitializeComponent();
        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void btnCalculate_Click(object sender, EventArgs e)
        {

            try //validation for inputbox number only
            {
                hours = Convert.ToInt32(txtHours.Text);
                if (hours > 744 || hours < 1)
                    MessageBox.Show("Entered hours is between 1-744");
            }
            catch (Exception h)
            {
                MessageBox.Show("Please provide number only");
            }
            if (chkNonProfit.Checked == true) //if nonprofit checkbox checked
            {

               // MessageBox.Show("20% discount on Nonprofit");
                if (rbtn10Hours.Checked == true)
                {
                    //MessageBox.Show("$12.95");
                    if (hours > 0 && hours <= 10)
                    {
                        price = 12.95; //actual price
                        NonProfitDiscount = 12.95 *.20; //calculate 20%
                        total = price - NonProfitDiscount; //total calculate - 20%
                        label3.Text = "$" + total.ToString(); //diplay total price after discount
                    }
                    else
                    {
                        hours = hours - 10; //calaculate the extra hours
                        double hours1 = (hours * 4) + 12.95; //calculate the extra hours of $4 per hours
                        NonProfitDiscount = hours1 *.20; //calculate 20%
                        total = hours1 - NonProfitDiscount;//total calculate - 20%
                        label3.Text = "$" + total.ToString(); //diplay total price after discount
                    }
                }
                else if (rbtn20Hours.Checked == true)
                {
                    //MessageBox.Show("$14.95");
                    if (hours > 0 && hours <= 20)
                    {
                        price = 14.95;//actual price
                        NonProfitDiscount = 14.95 *.20;//calculate 20%
                        total = price - NonProfitDiscount; //total calculate - 20%
                        label3.Text = "$" + total.ToString(); //diplay total price after discount
                    }
                    else
                    {
                        hours = hours - 20;//calaculate the extra hours
                        double hours1 = (hours * 2) + 14.95;//calculate the extra hours of $4 per hours
                        NonProfitDiscount = hours1 *.20; //calculate 20%
                        total = hours1 - NonProfitDiscount; //total calculate - 20%
                        label3.Text = "$" + total.ToString(); //diplay total price after discount
                    }
                }
                else if (rbtn30Hours.Checked == true)
                {
                    //MessageBox.Show("$20");
                    if (hours > 0 && hours <= 30)
                    {
                        price = 20.00; //actual price
                        NonProfitDiscount = 20.00 * .20; //calculate 20%
                        total = price - NonProfitDiscount; //total calculate - 20%
                        label3.Text = "$" + total.ToString(); //diplay total price after discount
                    }
                    else
                    {
                        hours = hours - 30; //calaculate the extra hours
                        double hours1 = (hours * 2) + 30.00; //calculate the extra hours of $4 per hours
                        NonProfitDiscount = hours1 *.20; //calculate 20%
                        total = hours1 - NonProfitDiscount; //total calculate - 20%
                        label3.Text = "$" + total.ToString(); //diplay total price after discount
                    }
                }
                else if (rbtnUnlimitedHours.Checked == true)
                {
                    MessageBox.Show("Unlimited Access");
                    if (hours > 0)
                    {
                        price = 35.95;//actual price
                        NonProfitDiscount = 20.00 * .20; //calculate 20%
                        total = price - NonProfitDiscount; //total calculate - 20%
                        label3.Text = "$" + price.ToString(); //diplay total price after discount
                    }
                }
            }
            else //if nonprofit checkbox not checked
            {
                if (rbtn10Hours.Checked == true)
                {
                    //MessageBox.Show("$12.95");
                    if (hours > 0 && hours <= 10)
                    {
                        price = 12.95; //actual price
                        label3.Text = "$" + price.ToString(); //display the price
                    }
                    else
                    {
                        hours = hours - 10;//calculate extra hours price
                        double hours1 = (hours * 4) + 12.95; //calculate total price
                        label3.Text = "$" + hours1.ToString(); //display total
                    }
                }
                else if (rbtn20Hours.Checked == true)
                {
                    //MessageBox.Show("$14.95");
                    if (hours > 0 && hours <= 20)
                    {
                        price = 14.95; //actual price
                        label3.Text = "$" + price.ToString(); //display the price
                    }
                    else
                    {
                        hours = hours - 20; //calculate extra hours price
                        double hours1 = (hours * 2) + 14.95;//calculate total price
                        label3.Text = "$" + hours1.ToString(); //display total
                    }
                }
                else if (rbtn30Hours.Checked == true)
                {
                   // MessageBox.Show("$30");
                    if (hours > 0 && hours <= 30)
                    {
                        price = 20.00; //actual price
                        label3.Text = "$" + price.ToString(); //display the price
                    }
                    else
                    {
                        hours = hours - 30; //calculate extra hours price
                        double hours1 = (hours * 1) + 20.00; //calculate total price
                        label3.Text = "$" + hours1.ToString(); //display total
                    }
                }
                else if (rbtnUnlimitedHours.Checked == true)
                {
                    MessageBox.Show("Unlimited Access");
                    if (hours > 0)
                    {
                        price = 35.95; //actual price
                        label3.Text = "$"+price.ToString(); //display total
                    }
                }
            }
        }  
    }
}

output:

Add a comment
Know the answer?
Add Answer to:
In Microsoft Visual Studio (C#): An Internet service provider offers four subscription packages to its customers,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • An Internet service provider offers four subscription packages to its customers, plus a discount for nonprofit...

    An Internet service provider offers four subscription packages to its customers, plus a discount for nonprofit organizations: Package A: 10 hours of access for $12.95 per month. Additional hours are $4.00 per hour. Package B: 20 hours of access for $14.95 per month. Additional hours are $2.00 per hour. Package C: 30 hours of access for $20 per month. Additional hours are $1.00 per hour. Package D: Unlimited access for $35.95 per month. A nonprofit organizations will get 20% discount...

  • An Internet service provider has three different subscription packages for its customers: Package A: For $15...

    An Internet service provider has three different subscription packages for its customers: Package A: For $15 per month with 50 hours of access provided. Additional hours are $2.00 per hour over 50 hours. Assume usage is recorded in one-hour increments. Package B: For $20 per month with 100 hours of access provided. Additional hours are $1.50 per hour over 100 hours. Package C: For $25 per month with 150 hours access is provided.    Additional hours are $1.00 per hour...

  • write in java and you must use methods.... Part I     Internet Service Provider An Internet service...

    write in java and you must use methods.... Part I     Internet Service Provider An Internet service provider has three different subscription packages for its customers: Package A: For $9.95 per month 10 hours of access are provided. Additional hours are $2.00 per hour. Package B: For $13.95 per month 20 hours of access are provided. Additional hours are $1.00 per hour. Package C: For $19.95 per month unlimited access is provided. Write a program that calculates a customer’s monthly bill....

  • Problem: Mobile Service Provider A mobile service provider has three different subscription packages for its customers:...

    Problem: Mobile Service Provider A mobile service provider has three different subscription packages for its customers: • Package A: For $50 per month, 5 GB data are provided. Additional data is $15 per GB. • Package B: For $65 per month, 10 data are provided. Additional data is $10 per GB. • Package C: For $75 per month unlimited data provided. Text messaging and voice services are included in all of the company's data packages. The Mobile Service Company offers...

  • Internet Service Provider

    Package A = $9.95 per month 10 hrs access provided. Additional hrs are $2 per hour.Package B= $13.95 per month 20 hrs access provided. Additional hrs are $1 per hour.Package C = $19.95 per month unlimited access provided.Write a program that calculates a customer's monthly bill to display the letter of the packaged purchased and the number of hours used. Finally display the totalcharges.

  • Part 1: A mobile phone service provider has three different data plans for its customers: Package...

    Part 1: A mobile phone service provider has three different data plans for its customers: Package A: For $39.99 per month 4 gigabytes are provided. Additional data costs $10 per gigabyte. Package B: For $59.99 per month, 8 gigabytes are provided. Additional data costs $5 per gigabyte. Package C: For $69.99 per month, unlimited data is provided. Write a program that calculates a customer's monthly bill. It should ask which package the customer has purchased and how many gigabytes were...

  • write in C++ Problem 1: Mobile Service Provider A cell phone service provider has three different...

    write in C++ Problem 1: Mobile Service Provider A cell phone service provider has three different subscription packages for its customers. Package A: For $39.99 per month 450 minutes are provided. Additional minutes are $0.45 per minute. Package B: For $59.99 per month 900 minutes are provided. Additional minutes are $0.40 per minute. Package C: For $69.99 per month unlimited minutes provided. Write a program that calculates a customer’s monthly bill. It should ask which package the customer has purchased...

  • THE CASE Sameer Arkell and Marcy Haddow had worked for Crowdsite, an international computer repair service,...

    THE CASE Sameer Arkell and Marcy Haddow had worked for Crowdsite, an international computer repair service, for ten years. It therefore came as a surprise when they both received lay-off notices on a Friday afternoon early January 2015. Both were given severance packages that matched their seniority so they decided that this might be the catalyst to launch their own business repairing computers and related equipment for businesses in their community. Both were single and had no children, so no...

  • SYNOPSIS The product manager for coffee development at Kraft Canada must decide whether to introduce the...

    SYNOPSIS The product manager for coffee development at Kraft Canada must decide whether to introduce the company's new line of single-serve coffee pods or to await results from the product's launch in the United States. Key strategic decisions include choosing the target market to focus on and determining the value proposition to emphasize. Important questions are also raised in regard to how the new product should be branded, the flavors to offer, whether Kraft should use traditional distribution channels or...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT