Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need to add extra charges for UPS and FedEx. Also the tax. But im not sure whe

ID: 3852933 • Letter: I

Question

I need to add extra charges for UPS and FedEx. Also the tax. But im not sure where to add it. I was thinking it should be in the groupBox. Also im not sure how to do the tax.

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 wfaStore

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

lblCost.Text = "0";

lblTax.Text = "0";

  

}

double[] itemPrice = {.59,1.1,.99,1.5,2.1,.75 };

int index;

private void listBox1_SelectedIndexChanged(object sender, EventArgs e)

{

lblCost.Text = "";

index = listBox1.SelectedIndex;

txtPrice.Text = string.Format("{0:c}", itemPrice[index]);

lblTax.Text = "";

}

private void button1_Click(object sender, EventArgs e)

{

decimal q = nudQuantity.Value;

double cost = itemPrice[index] * (Int32)q;

lblCost.Text = string.Format("{0:c}", cost);

}

private void btnSubmission_Click(object sender, EventArgs e)

{

MessageBox.Show("Your order has been submitted", "Order Dept.");

}

private void groupBox1_Enter(object sender, EventArgs e)

{

}

}

wfaStore - Microsoft Visual Studio Quick Launch (Ctrl+Q) File Edit View Project Build Debug Team Format Tools Test Analyze Wiow Help Sign in Sign in | T.. X Form1.cs Form 1.cs [Design] × & Search Tool Simple Shop TEMS Shoe Search Solu Co.. -Solution- Price ie Pants T-shirt Shirt Hat Pr Quantity 0 Shipment O UPS O FedEX Fc Pr Tax label6 COST label5 Cal Cost Submit IE Form 1 Sys- Maxin T1 Maxin 0 Minim T Minimo, Opaci 1 Paddi10 Rightl N Rightl Fa Con... D Men... D Data Output Show output from: Debug "wfastore.exe . (CLR v4.0.30319 : wfaStore . exe): Loaded .C:windowsMicrosoft.Net wfaStore.exe' (CLR v4.0.30319: wfaStore.exe): Loaded 'C: windows Microsoft.Net wfaStore.exe' (CLR v4.0.30319: wfaStore.exe) Loaded C: windows Microsoft.Net The program "[4512] wfastore . exe' has exited with code 0 (0x0) Showl T Size 3 SizeG1A StartP W Prin Dia... Tag Text Si TnnM. F Gen... 19,19 -' 397 x 368 Add to Source Control

Explanation / Answer

No, it should not be calculated in groupBox instead the calculation of extra charges for the shipment and the tax should be done in method of button1_click.

Look at the code below,

private void button1_Click(object sender, EventArgs e)

{

decimal q = nudQuantity.Value;

double cost = itemPrice[index] * (Int32)q;

double extracharge = 0; // to store extracharges of UPS and FedEx based on their selection

double tax = (10 * cost) / 100 ; // calculating tax, please change the tax % as according to the original // question

if(radioButton_UPS.checked == true)

extracharge = 10; // assign the extracharge of UPS, change the value as according to its original charge

if(radioButton_FedEx.checked == true)

  extracharge = 15; // assign the extracharge of FedEx, change the value as according to its original charge

lblCost.Text = string.Format("{0:c}", (cost + extracharge + tax)); // cost = cost + extracharge + tax

lblTax.Text = tax.ToString();

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote