## In Focus

AuthorQuestion
Programming Exercises
Posted on 26 Apr 2009

5.  Software Sales

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

Quantity                        Discount

10-19                        20%

20-49                     30%

50-99                     40%

100 or more           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

Rewrite If-Then-Else If statement as a Select Case statement.
If selection == 1 Then
Display "You selected A,"
Else If selection == 2 Then
Display "You selected 2"
Else If selection == 3 Then
Dsplay "You selected 3."
Else If selection == 4 Then
Display "You selected 4."
Else
Display "Not good with numbers, eh?
End If

2.  Design an If-Then-Else statement or a flowchart with a dual alternative decsion structure that display "Speed is normal" if the speed variable is within the range of 24 to 56. If speed holds a value outside this range, display "Speed is abnormal."

These are 2 of the questions we need to do. There are 2 more/
• 0
• 0
Re: Programming Exercises
Posted on 27 Apr 2009
Hi,

Console.WriteLine("Enter no of packeges purchased");

int amt = qty * 99;
double dis=0;
if (qty >= 10 && qty <= 19)
dis = amt * 0.2;
else if (qty >= 20 && qty <= 49)
dis = amt * 0.3;
else if (qty >= 50 && qty <= 99)
dis = amt * 0.4;
else if (qty >= 100 )
dis = amt * 0.5;

Console.WriteLine("Amount  \$" + amt);
Console.WriteLine("Discount \$" + dis);
Console.WriteLine("Net Amount \$" + (amt - dis));

Happy to Learn
Vimal Kandasamy