Employee information obtained by properties and methods: First name is SueLast name is JonesSocial security number is 222-22-2222Gross sales are $10,000.00Commission rate is 0.06Earnings are $600.00Updated employee information obtained by ToString:commission employee: Sue Jonessocial security number: 222-22-2222gross sales: $5,000.00commission rate: 0.10earnings: $500.00
Employee information obtained by properties and methods:First name is SueLast name is JonesSocial security number is 222-22-2222Gross sales are 10000.00Commission rate is 0.06Earnings are 600.0000
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 L7a{ public partial class Form1 : Form { public Form1 ( ) { InitializeComponent ( ); } public void Form1_Load (object sender, EventArgs e) { // instantiate CommissionEmployee object CommissionEmployee employee = new CommissionEmployee( // Create a CommissionEmployee object "Sue", "Jones", "222-22-2222", 10000.00M, .06M); // display commission employee data textBox1.Text = String.Format ( "Employee information obtained by properties and methods:" + "\r\n") + String.Format ( "{0} {1}", "First name is", employee.FirstName + "\r\n" ) + String.Format ( "{0} {1}", "Last name is", employee.LastName + "\r\n" ) + String.Format ( "{0} {1}", "Social security number is", employee.SocialSecurityNumber + "\r\n" ) + String.Format ( "{0} {1:C}", "Gross sales are", employee.GrossSales + "\r\n" ) + String.Format ( "{0} {1:F2}", "Commission rate is", employee.CommissionRate + "\r\n" ) + String.Format ( "{0} {1:C}", "Earnings are", employee.Earnings() + "\r\n" ); // Change prperties of CommissionEmployee object employee.CommissionRate = .1M; // <--set commission rate String.Format ( "\n{0}:\n\n{1}", "Updated employee information obtained by ToString", employee ); String.Format ( "earnings: {0:C}", employee.Earnings () ); employee.GrossSales = 10000.00M; // set gross sales }// end main }// end class commissionEmployeeTest}