In: Computer Science
Need it in C# using visual studio (also can you show me how to implement the code in vs)
Create a New Project named Preferred Customer to be used in a retail store for preferred customers, where customers can earn discount on all purchases depending upon how much money they are going to spend. To begin with designing your Application, you must add a class named Person with properties for holding a Person’s Name, Address and Telephone Number. Next step is to create a class named Customer, which is derived from the Person class. The Customer class must have a property for Customer Number and a Boolean property indicating whether customer wished to be on a mailing list. Further, design a class named PreferredCustomer, which is derived from the Customer class. The PreferredCustomer Class must have properties for an amount of the customer’s purchases and the customer’s % discount earned. The GUI of Application (Form1 object) must have four input Text Boxes: (1) one for customer’s Full Name, (2) the second for customer’s Full Address, (3) the third one for customer’s Phone Number and (4) the fourth one for customer’s Purchased Amount as shown in Fig. 1. BorderStyle property of the Purchased Amount text box control is to be set at Fixed3D. In addition to these four Text Boxes, your Application must have one Radio button and one Display button controls: (1) Radio button is used to add customer’s name in mailing list or not, and (2) Display button, when clicked demonstrates the class in this Application. When you click Display button without entering any real data in tis GUI, the Application must show a message in a Message Box that “Input string was not in a correct format”, which is shown in Figure 2 on page # 2. Then you click OK button to enter real data input in Application’s GUI. Your Application must have provision of Close and Clear buttons in its interface so that it could be possible to close it and clear all controls in its GUI. It is required that your GUI should be displayed at the Center of your computer’s monitor and your source code must have Comment Lines at appropriate places. Take a screen-shot of your GUI for each run, copy and paste it in a MS Word doc file.
OUTPUT-
CODE-
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace PreferredCustomer
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
PreferredCustomer customer = new PreferredCustomer();
customer.name = textBox1.Text;
customer.address = richTextBox1.Text;
customer.contact = textBox2.Text;
customer.amountPurchased = Convert.ToDouble(textBox3.Text);
if(radioButton1.Checked==true)
{
customer.mailingList = false;
}
else
{
customer.mailingList = true;
}
if (customer.amountPurchased == 500)
customer.discount = "5%";
if (customer.amountPurchased == 1000)
customer.discount = "6%";
if(customer.amountPurchased==1500)
customer.discount="7%";
if (customer.amountPurchased == 2000)
customer.discount = "10%";
MessageBox.Show("Name: " + customer.name + "\n" + "Address: " +
customer.address + "\n" + "Phone: " + customer.contact + "\n" +
"Amount purchased: " + customer.amountPurchased + "Future discount
value is " + customer.discount);
}
}
public class PreferredCustomer{
public string name;
public string contact;
public string address;
public bool mailingList=true;
public double amountPurchased;
public string discount;
}
}