Can you solve this proble by using C# application? C# is one of programming languages supported by Visual Studio 2015. It combines the features of Java and C ++ and is suitbale for rapid application development.
A retail company must file a monthly sales tax report listing the total sales for the month, and the amount of state and county sales tax collected. The state sales tax rate is 4% and the county sales tax rate is 2%. Create an application that allows the user to enter the total sales from the month.
From this figure, the application should calculate and display the following:
1. The amount of country sales tax
2. The amount of state sales tax
3. The total sales tax (county plus state)
The following represents the requirements for this project:
1. The project should be named Project1
2. When saving the project, uncheck the “Create directory for solution” checkbox.
3. The form (file and object name) should be renamed from Form1 to frmMain
4. The form layout should be very similar to the following in terms of control alignment, sizes, spelling, meaningful labels and an overall professional look:
5. When the application is run have the form display in the middle of the screen.
6. Set the Form Accept and Cancel Button properties.
7. The label controls for the County, State and Total Sales Tax should be contained within a Group Box.
8. The labels which display the type of sales tax should all be aligned to the right.
9. The labels which display each of the sales tax should have the Border Style property set to Fixed3D.
10. Each button control should have an access key defined.
Once you are done with the final design of the form layout then lock all the controls.
13. In the code, add the following comment lines at the top of the file. Replace the with the appropriate information.
//Project: Project #1
//Programmer:
14. In the code, represent the county tax rate (0.02) and the state tax rate (0.04) as named constants. Use the named constants in the mathematical statements.
15. The Calculate button should use the amount from the Total Monthly Sales textbox to calculate and display the County Sales Tax, State Sales Tax and Total Sales Tax. The display amounts should be formatted to currency with two decimal places. If the user fails to enter numeric values, display an appropriate error message and do not attempt to perform the calculations. A Try-Catch block should be used to catch any invalid data entered for the Total Monthly Sales.
16. The Clear button should clear the textbox and all the calculated sales tax labels. It should then set the focus back to the textbox control.
17. The Exit button should cause the application to end.
18. Use the following test data to determine whether the application is calculating properly.
Total Monthly Sales Taxes Amount 9500 County Sales Tax $190.00 State Sales Tax $380.00 Total Sales Tax $570.00 5000 County Sales Tax $100.00 State Sales Tax $200.00 Total Sales Tax $300.00 15000 County Sales Tax $300.00 State Sales Tax $600.00 Total Sales Tax $900.00
Program.cs
--------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Sales_Tax_and_Total
{
static class Program
{
///
<summary>
/// The main entry point
for the application.
///
</summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
-----------------------------------------
Form1.cs
------------------------
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 Sales_Tax_and_Total
{
public partial class Form1 : Form
{
private const decimal
STATE_TAX_RATE = 0.04m;
private const decimal
COUNTY_TAX_RATE = 0.02m;
public Form1()
{
InitializeComponent();
}
private void
btnCalculate_Click(object sender, EventArgs e)
{
try
{
// Set variables.
decimal purchasePrice;
decimal stateTax;
decimal countyTax;
decimal totalTax;
decimal totalPrice;
// Get the purchase price.
purchasePrice = decimal.Parse(txtPurchasePrice.Text);
// Calculate the price.
stateTax = purchasePrice * STATE_TAX_RATE;
countyTax = purchasePrice * COUNTY_TAX_RATE;
totalTax = stateTax + countyTax;
totalPrice = purchasePrice + totalTax;
// Display the prices.
txtPurchasePrice.Text = purchasePrice.ToString("c");
lblStateTax.Text = stateTax.ToString("c");
lblCountyTax.Text = countyTax.ToString("c");
lblTotalTax.Text = totalTax.ToString("c");
lblTotalPrice.Text = totalPrice.ToString("c");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
// Set focus to clear button.
btnClear.Focus();
}
private void
btnClear_Click(object sender, EventArgs e)
{
// Clear controls.
txtPurchasePrice.Text = "";
lblStateTax.Text = "";
lblCountyTax.Text = "";
lblTotalTax.Text = "";
lblTotalPrice.Text = "";
// Set focus to text box.
txtPurchasePrice.Focus();
}
private void
btnExit_Click(object sender, EventArgs e)
{
// Close the form.
this.Close();
}
}
}
--------------------------------------------------------------------------
Form1.Designer.cs
---------------------------------
namespace Sales_Tax_and_Total
{
partial class Form1
{
///
<summary>
/// Required designer
variable.
///
</summary>
private
System.ComponentModel.IContainer components = null;
///
<summary>
/// Clean up any
resources being used.
///
</summary>
/// <param
name="disposing">true if managed resources should be disposed;
otherwise, false.</param>
protected override void
Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
///
<summary>
/// Required method for
Designer support - do not modify
/// the contents of this
method with the code editor.
///
</summary>
private void
InitializeComponent()
{
this.lblPurchasePriceCaption = new
System.Windows.Forms.Label();
this.lblStateTaxCaption = new System.Windows.Forms.Label();
this.lblCountyTaxCaption = new System.Windows.Forms.Label();
this.lblTotalTaxCaption = new System.Windows.Forms.Label();
this.lblTotalPriceCaption = new System.Windows.Forms.Label();
this.txtPurchasePrice = new System.Windows.Forms.TextBox();
this.lblStateTax = new System.Windows.Forms.Label();
this.lblCountyTax = new System.Windows.Forms.Label();
this.lblTotalTax = new System.Windows.Forms.Label();
this.lblTotalPrice = new System.Windows.Forms.Label();
this.btnCalculate = new System.Windows.Forms.Button();
this.btnClear = new System.Windows.Forms.Button();
this.btnExit = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// lblPurchasePriceCaption
//
this.lblPurchasePriceCaption.AutoSize = true;
this.lblPurchasePriceCaption.Location = new
System.Drawing.Point(11, 15);
this.lblPurchasePriceCaption.Name =
"lblPurchasePriceCaption";
this.lblPurchasePriceCaption.Size = new System.Drawing.Size(108,
13);
this.lblPurchasePriceCaption.TabIndex = 0;
this.lblPurchasePriceCaption.Text = "Enter purchase price:";
//
// lblStateTaxCaption
//
this.lblStateTaxCaption.AutoSize = true;
this.lblStateTaxCaption.Location = new System.Drawing.Point(40,
48);
this.lblStateTaxCaption.Name = "lblStateTaxCaption";
this.lblStateTaxCaption.Size = new System.Drawing.Size(79,
13);
this.lblStateTaxCaption.TabIndex = 1;
this.lblStateTaxCaption.Text = "State sales tax:";
//
// lblCountyTaxCaption
//
this.lblCountyTaxCaption.AutoSize = true;
this.lblCountyTaxCaption.Location = new System.Drawing.Point(32,
76);
this.lblCountyTaxCaption.Name = "lblCountyTaxCaption";
this.lblCountyTaxCaption.Size = new System.Drawing.Size(87,
13);
this.lblCountyTaxCaption.TabIndex = 2;
this.lblCountyTaxCaption.Text = "County sales tax:";
//
// lblTotalTaxCaption
//
this.lblTotalTaxCaption.AutoSize = true;
this.lblTotalTaxCaption.Location = new System.Drawing.Point(41,
104);
this.lblTotalTaxCaption.Name = "lblTotalTaxCaption";
this.lblTotalTaxCaption.Size = new System.Drawing.Size(78,
13);
this.lblTotalTaxCaption.TabIndex = 3;
this.lblTotalTaxCaption.Text = "Total sales tax:";
//
// lblTotalPriceCaption
//
this.lblTotalPriceCaption.AutoSize = true;
this.lblTotalPriceCaption.Font = new System.Drawing.Font("Microsoft
Sans Serif", 8.25F, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblTotalPriceCaption.Location = new System.Drawing.Point(47,
132);
this.lblTotalPriceCaption.Name = "lblTotalPriceCaption";
this.lblTotalPriceCaption.Size = new System.Drawing.Size(72,
13);
this.lblTotalPriceCaption.TabIndex = 4;
this.lblTotalPriceCaption.Text = "Total price:";
//
// txtPurchasePrice
//
this.txtPurchasePrice.Location = new System.Drawing.Point(125,
12);
this.txtPurchasePrice.Name = "txtPurchasePrice";
this.txtPurchasePrice.Size = new System.Drawing.Size(120,
20);
this.txtPurchasePrice.TabIndex = 0;
this.txtPurchasePrice.TextAlign =
System.Windows.Forms.HorizontalAlignment.Center;
//
// lblStateTax
//
this.lblStateTax.BorderStyle =
System.Windows.Forms.BorderStyle.FixedSingle;
this.lblStateTax.Location = new System.Drawing.Point(125,
43);
this.lblStateTax.Name = "lblStateTax";
this.lblStateTax.Size = new System.Drawing.Size(120, 23);
this.lblStateTax.TabIndex = 1;
this.lblStateTax.TextAlign =
System.Drawing.ContentAlignment.MiddleCenter;
//
// lblCountyTax
//
this.lblCountyTax.BorderStyle =
System.Windows.Forms.BorderStyle.FixedSingle;
this.lblCountyTax.Location = new System.Drawing.Point(125,
71);
this.lblCountyTax.Name = "lblCountyTax";
this.lblCountyTax.Size = new System.Drawing.Size(120, 23);
this.lblCountyTax.TabIndex = 2;
this.lblCountyTax.TextAlign =
System.Drawing.ContentAlignment.MiddleCenter;
//
// lblTotalTax
//
this.lblTotalTax.BorderStyle =
System.Windows.Forms.BorderStyle.FixedSingle;
this.lblTotalTax.Location = new System.Drawing.Point(125,
99);
this.lblTotalTax.Name = "lblTotalTax";
this.lblTotalTax.Size = new System.Drawing.Size(120, 23);
this.lblTotalTax.TabIndex = 3;
this.lblTotalTax.TextAlign =
System.Drawing.ContentAlignment.MiddleCenter;
//
// lblTotalPrice
//
this.lblTotalPrice.BorderStyle =
System.Windows.Forms.BorderStyle.FixedSingle;
this.lblTotalPrice.Location = new System.Drawing.Point(125,
127);
this.lblTotalPrice.Name = "lblTotalPrice";
this.lblTotalPrice.Size = new System.Drawing.Size(120, 23);
this.lblTotalPrice.TabIndex = 4;
this.lblTotalPrice.TextAlign =
System.Drawing.ContentAlignment.MiddleCenter;
//
// btnCalculate
//
this.btnCalculate.Location = new System.Drawing.Point(23,
163);
this.btnCalculate.Name = "btnCalculate";
this.btnCalculate.Size = new System.Drawing.Size(75, 24);
this.btnCalculate.TabIndex = 5;
this.btnCalculate.Text = "Calculate";
this.btnCalculate.UseVisualStyleBackColor = true;
this.btnCalculate.Click += new
System.EventHandler(this.btnCalculate_Click);
//
// btnClear
//
this.btnClear.Location = new System.Drawing.Point(104, 163);
this.btnClear.Name = "btnClear";
this.btnClear.Size = new System.Drawing.Size(75, 24);
this.btnClear.TabIndex = 6;
this.btnClear.Text = "Clear";
this.btnClear.UseVisualStyleBackColor = true;
this.btnClear.Click += new
System.EventHandler(this.btnClear_Click);
//
// btnExit
//
this.btnExit.DialogResult =
System.Windows.Forms.DialogResult.Cancel;
this.btnExit.Location = new System.Drawing.Point(185, 163);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(75, 24);
this.btnExit.TabIndex = 7;
this.btnExit.Text = "Exit";
this.btnExit.UseVisualStyleBackColor = true;
this.btnExit.Click += new
System.EventHandler(this.btnExit_Click);
//
// Form1
//
this.AcceptButton = this.btnCalculate;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnExit;
this.ClientSize = new System.Drawing.Size(284, 200);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.btnClear);
this.Controls.Add(this.btnCalculate);
this.Controls.Add(this.lblTotalPrice);
this.Controls.Add(this.lblTotalTax);
this.Controls.Add(this.lblCountyTax);
this.Controls.Add(this.lblStateTax);
this.Controls.Add(this.txtPurchasePrice);
this.Controls.Add(this.lblTotalPriceCaption);
this.Controls.Add(this.lblTotalTaxCaption);
this.Controls.Add(this.lblCountyTaxCaption);
this.Controls.Add(this.lblStateTaxCaption);
this.Controls.Add(this.lblPurchasePriceCaption);
this.Name = "Form1";
this.Text = "Sales Tax and Total";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private
System.Windows.Forms.Label lblPurchasePriceCaption;
private
System.Windows.Forms.Label lblStateTaxCaption;
private
System.Windows.Forms.Label lblCountyTaxCaption;
private
System.Windows.Forms.Label lblTotalTaxCaption;
private
System.Windows.Forms.Label lblTotalPriceCaption;
private
System.Windows.Forms.TextBox txtPurchasePrice;
private
System.Windows.Forms.Label lblStateTax;
private
System.Windows.Forms.Label lblCountyTax;
private
System.Windows.Forms.Label lblTotalTax;
private
System.Windows.Forms.Label lblTotalPrice;
private
System.Windows.Forms.Button btnCalculate;
private
System.Windows.Forms.Button btnClear;
private
System.Windows.Forms.Button btnExit;
}
}
Can you solve this proble by using C# application? C# is one of programming languages supported...
Project 2 Description Create a Visual C# project that when an employee's biweekly sales amount is entered and the Calculate button is pressed, the gross pay, deductions, and net pay will be displayed. Each employee will receive a base pay of $1200 plus a sales commission of 8% of sales. Once the net pay has been calculated, display the budget amount for each category listed below based on the percentages given. base pay = $1200; use a named...
Write a C# code for a Sales Calculator: Note: You cannot use the foreach loop in any part of this program! sales.txt file: 1189.55, 1207.00, 1348.27, 1456.88, 1198.34, 1128.55, 1172.37, 1498.55, 1163.29 The application should have controls described as follows: • A button that reads Get Sales. If the user clicks this button, the application should call a method named ProcesSalesFile. ProcessSalesFile Method: accepts no arguments and does not return anything The ProcessSalesFile Method will do the following: o Open...
Write a C# code for a Sales Calculator: Note: You cannot use the foreach loop in any part of this program! sales.txt file: 1189.55, 1207.00, 1348.27, 1456.88, 1198.34, 1128.55, 1172.37, 1498.55, 1163.29 The application should have controls described as follows: • A button that reads Get Sales. If the user clicks this button, the application should call a method named ProcesSalesFile. ProcessSalesFile Method: accepts no arguments and does not return anything The ProcessSalesFile Method will do the following: o Open...
Property Tax Program -Must use C programming I attempted this program but couldn't figure what I did wrong ;( Property Tax Program Complete the following program: A retail company must file a monthly sales tax report listing the total sales for the month and the amount of state and county sales tax collected. The state sales tax rate is (4 percent and the county sales tax rate is 2 percent. Write a program that asks the user to enter the...
Visual Basic Programming Step 1-2 not important, it's just file naming. 3. Form contains nine Labels, one TextBox, and three Button controls. You use labels to let user know what to enter and what will be displayed; TextBoxes to input a number between 1 and 99. Buttons to Calculate change. Clear Input and Exit program. See below Form Layout with Controls for more details 4. Declare variables to store the entered value in TextBox, and what will be displayed in...
Visual Basic Programming Step 1-2 not important, it's just file naming. 3. Form contains nine Labels, one TextBox, and three Button controls. You use labels to let user know what to enter and what will be displayed; TextBoxes to input a number between 1 and 99. Buttons to Calculate change. Clear Input and Exit program. See below Form Layout with Controls for more details 4. Declare variables to store the entered value in TextBox, and what will be displayed in...
Using C# Language Develop a Visual C# .NET application that performs a colour control operation. The main form contains a reset button and sets the form's background colour according to the colour values indicated by the colour control objects. Each colour control object is controlled by a corresponding colour control form which provides a progress bar to show the value (in the range 0 to 255) of the corresponding colour control object. The user can click the increase (+) or...
Programming question. Using Visual Studio 2019 C# Windows Form Application (.NET Framework) Please include code for program with ALL conditions met. Conditions to be met: Word Problem A person inherits a large amount of money. The person wants to invest it. He also has to withdraw it annually. How many years will it take him/her to spend all of the investment that earns at a 7% annual interest rate? Note that he/she needs to withdraw $40,000.00 a year. Also there...
How do you do this using visual studio on a Mac? You are tasked with creating an application with five PictureBox controls. In the Poker Large folder, you will find JPEG image files for a complete deck of poker cards. Feel free to choose any card image that you like or be creative with this application. Each PictureBox should display a different card from the set of images. When the user clicks any of the PictureBox controls, the name of...