Write a program for an Internet provider that displays a MessageBox asking users whether they want Internet access. If they do not, their total price is $0. If they do, display a second MessageBox asking whether they want limited access (at $10.95 per month) or unlimited access (at $19.95 per month). Display the total price in a third MessageBox. Title the program InternetAccess.
Here is my code 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.Threading.Tasks;
using System.Windows.Forms;
namespace Internet
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
DialogResult unlimited;
DialogResult choice = MessageBox.Show("Internet Services are available as limited access at $10.95 per month \n and unlimited access at $19.95 per month.\n Do you want internet connection?",
"Internet Service", MessageBoxButtons.YesNo);
if (choice == DialogResult.Yes)
unlimited = MessageBox.Show("Do you want unlimited package?", "Package", MessageBoxButtons.YesNo);
if (unlimited == DialogResult.Yes);
MessageBox.Show("Your price is $19.95 per month");
else;
MessageBox.Show("Your price is $10.95 per month");
else;
MessageBox.Show("display a total price of $0");
}
}
}
}
I'm not at all sure where I am going wrong!
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Well for a start an 'if' statement doesn't end in a semi-colon, and neither does 'else'.
Although not strictly speaking necessary i would go with curly braces on all if statements for readability.
I presume you have this working now.