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

Software sales A software company sells a package that retails for $99. Quantity

ID: 3775223 • Letter: S

Question

Software sales

A software company sells a package that retails for $99. Quantity discounts are given according to the following table.

10-19 20%

20-49 30%

50-99 40%

100 or more 50%

Create an application that lets the user 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.

This is what I have so far

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 Software_Sales
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void buttonCalculateTotals_Click(object sender, EventArgs e)
        {
            // Named constants
                    const decimal SinglePackagePrice = 99m;
                    const decimal ZeroToNine = 1m;
                    const decimal TenToNineteen = .2m;
                    const decimal TwentyToFortyNine = .3m;
                    const decimal FiftyToNinetyNine = .4m;
                    const decimal>

            // Local variables
                    decimal TotalNumberOfUnits;     // Total number of units sold
                   
           
            // Get the total number of units sold
                    TotalNumberOfUnits = decimal.Parse(textQuantitySold.Text);

            // Calculate total discount
                    if

        }
    }
}

after the "if", I am completely lost, could you please explain where I need to go from here?

thanks

John

Explanation / Answer

//Declare these local variables

string totalamount; //for total amount of the purchase

string discountamount; // for discount amount of the purchase

decimal discountvalue; // for discount amount of the purchase in decimal value

decimal totalvalue; // for total amount of the purchase in decimal value

decimal TotalPackagePrice;

//Since, the discount value is fixed

if (TotalNumberOfUnits<10)

{

Console.WrileLine (" No Discount ");

discountvalue = 0m; // No discount

discountamount = String.Format("Discount Amount : {0:C}", discountamount);

totalvalue = TotalNumberOfUnits * SinglePackagePrice; // Calc of toal amount of packages

totalamount = String.Format("Order Total : {0:C}", totalvalue); // Formatting the amount in $ format

Console.WriteLine(totalamount); // Displaying in output

}

else if(TotalNumberOfUnits>=10 && TotalNumberOfUnits<=19)

{

Console.WriteLine("You get 20% discount");

TotalPackagePrice = SinglePackagePrice * TotalNumberOfUnits;

discountvalue = (TotalPackagePrice * 20)/100; // Calc discount amount

discountamount = String.Format("Discount Amount : {0:C}", discountvalue);

Console.WriteLine(discountamount);

totalvalue = TotalPackagePrice - discountvalue;

totalamount = String.Format("Order Total : {0:C}", totalvalue);

Console.WriteLine(totalamount);

}

else if(TotalNumberOfUnits>=20 && TotalNumberOfUnits<=49)

{

Console.WriteLine("You get 30% discount");

TotalPackagePrice = SinglePackagePrice * TotalNumberOfUnits;

discountvalue = (TotalPackagePrice * 30)/100;

discountamount = String.Format("Discount Amount : {0:C}", discountvalue);

Console.WriteLine(discountamount);

totalvalue = TotalPackagePrice - discountvalue;

totalamount = String.Format("Order Total : {0:C}", totalvalue);

Console.WriteLine(totalamount);

}

else if(TotalNumberOfUnits>=50 && TotalNumberOfUnits<=99)

{

Console.WriteLine("You get 40% discount");

TotalPackagePrice = SinglePackagePrice * TotalNumberOfUnits;

discountvalue = (TotalPackagePrice * 40)/100;

discountamount = String.Format("Discount Amount : {0:C}", discountvalue);

Console.WriteLine(discountamount);

totalvalue = TotalPackagePrice - discountvalue;

totalamount = String.Format("Order Total : {0:C}", totalvalue);

Console.WriteLine(totalamount);

}

else if(TotalNumberOfUnits>=100)

{

Console.WriteLine("You get 50% discount");

TotalPackagePrice = SinglePackagePrice * TotalNumberOfUnits;

discountvalue = (TotalPackagePrice * 50)/100;

discountamount = String.Format("Discount Amount : {0:C}", discountvalue);

Console.WriteLine(discountamount);

totalvalue = TotalPackagePrice - discountvalue;

totalamount = String.Format("Order Total : {0:C}", totalvalue);

Console.WriteLine(totalamount);

}

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