A software company sells a package that retails for $99. Quantity discounts are
ID: 3650361 • Letter: A
Question
A software company sells a package that retails for $99. Quantity discounts are given according to the following table.Quantity 10-19 Discount 20%
Quantity 20-49 Discount 30%
Quantity 50-99 Discount 40%
Quantity 100 or more Discount 50%
Design a program that asks the user to enter the number of packages purchased. The program should then display the amount of the discount (if any) and the total amount of the purchase after the discount.
have this much done
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 Software_Sales_3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void caculateButton_Click(object sender, EventArgs e)
{
double PackagesPurchased;
double TotalDiscount;
PackagesPurchased = double.Parse(PackagesPurchasedTextbox.Text);
if (PackagesPurchased >= 100)
{
DiscountLabel.Text = "50%";
}
else if (PackagesPurchased >= 50)
{
DiscountLabel.Text = "40%";
}
else if (PackagesPurchased >= 20)
{
DiscountLabel.Text = "30%";
}
else if (PackagesPurchased >=10)
{
DiscountLabel.Text = "20%";
}
TotalDiscount = PackagesPurchased;
}
}
}
Explanation / Answer
double discount( int quantity, double priceEach ) { double discount = 0.0; if (quantity >= 10) discount = 0.2; if(quantity >= 20) discount = 0.3; if(quantity >= 50 discount = 0.4; if(quantity >= 100) discount = 0.5; return quantity * (1.0 - discount) * priceEach; } 1 year ago
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.