I need the code to run a program using the GUI I have created. Please post the c
ID: 3543442 • Letter: I
Question
I need the code to run a program using the GUI I have created. Please post the code in your answer.
The veteran discount rate should be 10% and the active duty discount rate should be 5%.
After the btnBookit has been used there should be a message box that appears with the booked information, i.e. "Congratulations, you have booked a 'standard/delux room for date/date with a discount of __ and a total of ___.
I already have the images and code for the picturebox so no need for that.
The clear button must work as well.
There must also be error messages for items.
Here is the GUI
I need the code to run a program using the GUI I have created. Please post the code in your answer. The veteran discount rate should be 10% and the active duty discount rate should be 5%. After the btnBookit has been used there should be a message box that appears with the booked information, i.e. "Congratulations, you have booked a 'standard/delux room for date/date with a discount of __ and a total of ___. I already have the images and code for the picturebox so no need for that. The clear button must work as well. There must also be error messages for items. Here is the GUIExplanation / Answer
The vb version of the same code is here ...
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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
double discount;
string roomtype = "Standard";
double total = 0;
double totalafterdiscount = 0;
private void btnBlockit_Click(object sender, EventArgs e)
{
// I assumed these two values because
// total was not given anywhere
// Please add your own code instead of the above two lines.
if (roomtype == "Standard")
total = 1000;
else
total = 1500;
if (rbActiveDuty.Checked)
{
discount = 5;
}
else if (rbYes.Checked)
{
discount = 10;
}
else
{
discount = 0;
}
totalafterdiscount = (total * (100 - discount)) / 100;
labelMessage.Text = "Congratulations, you have booked a "+roomtype+" room for "+txtFrom.Text+"/"+txtTo.Text+ " with a discount of "+discount+"% and a total of "+totalafterdiscount;
}
private void btnClear_Click(object sender, EventArgs e)
{
txtFrom.Text = "";
txtTo.Text = "";
rbYes.Checked = false;
rbNo.Checked = false;
rbActiveDuty.Checked = false;
}
private void btnStandard_Click(object sender, EventArgs e)
{
roomtype = "Standard";
}
private void btnDeluxe_Click(object sender, EventArgs e)
{
roomtype = "Deluxe";
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
}
}