} Expected error file form1.cs Line 43 column2 sales_discountwith_IF - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

} Expected error file form1.cs Line 43 column2 sales_discountwith_IF

ipodtripipodtrip Posts: 8Member
trying to write a C# program if total sales greater than 1000 then the customer will get 10% discount otherwise the custer get a 5% discount.
I tried to run the program to test it but have this little red swiggle line on the last bracket. Don't know what it means. I am trying to do a if then else program.
here is my code.

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 Sales_Discount_with_IF
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
double totalSales, discountRate, NetPay;
string myMsg;
totalSales = double.Parse(textBox1.Text);
if (totalSales<=1000)
{
discountRate =.05;
NetPay=totalSales*(1-discountRate);
myMsg = "Thank you";
}
else
{
discountRate = .1;
NetPay =totalSales*(1-discountRate);
myMsg = "thank you very much!";

{
textBox2.Text=NetPay.ToString("C");
MessageBox.Show(myMsg);

}
}
}
} On this last bracket I have a little red swiggle line.
Sign In or Register to comment.