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. Time Calculator Design a program that asks the user to enter the number of seconds, and works as follows: There are 60 seconds in a minute. If the number of seconds entered by the user is greater than or equal to 60, the program should display the number of minutes in that many seconds. There are 3,600 seconds in an hour. If the number of seconds entered by the user is greater than or equal to 3,600, the program should display the number of hours in that many seconds. There are 86,400 seconds in a day. If the number of seconds entered by the user is greater than or equal to 86,400, the program should display the number of days in that many seconds. The teacher would like pseudocode and flowcharts as well as visual basic language

Designing the Program:
To design a program that calculates the discount and total purchase amount based on the quantity of packages purchased, we can follow these steps:

1. Initialize variables: Set the retail price of the package as $99.00 and create variables for the quantity of packages purchased, discount percentage, discount amount, and total purchase amount.

2. Input: Prompt the user to enter the number of packages purchased and store it in the quantity variable.

3. Calculation: Use a series of if-else statements to determine the discount percentage based on the quantity entered:
– If the quantity is between 10 and 19, set the discount percentage as 20%.
– If the quantity is between 20 and 49, set the discount percentage as 30%.
– If the quantity is between 50 and 99, set the discount percentage as 40%.
– If the quantity is 100 or more, set the discount percentage as 50%.

4. Calculate the discount amount by multiplying the discount percentage with the retail price: discount = (discount percentage / 100) * retail price.

5. Calculate the total purchase amount by subtracting the discount amount from the retail price: total amount = retail price – discount amount.

6. Output: Display the discount amount (if any) and the total purchase amount to the user.

Pseudocode:

Set retail price = $99.00
Input quantity

If quantity >= 10 and quantity <= 19 discount percentage = 20 Else if quantity >= 20 and quantity <= 49 discount percentage = 30 Else if quantity >= 50 and quantity <= 99 discount percentage = 40 Else if quantity >= 100
discount percentage = 50
End if

discount amount = (discount percentage / 100) * retail price
total purchase amount = retail price – discount amount

Output discount amount (if any)
Output total purchase amount

Flowchart:
Please refer to the attached flowchart that illustrates the steps mentioned in the pseudocode.

Visual Basic (VB) Implementation:

To implement the program in Visual Basic, you can use the following code:

‘ Initialize variables
Dim retailPrice As Double = 99.0
Dim quantity As Integer
Dim discountPercentage As Integer
Dim discountAmount As Double
Dim totalAmount As Double

‘ Get user input
quantity = InputBox(“Enter the number of packages purchased:”)

‘ Determine discount percentage
If quantity >= 10 AndAlso quantity <= 19 Then discountPercentage = 20 ElseIf quantity >= 20 AndAlso quantity <= 49 Then discountPercentage = 30 ElseIf quantity >= 50 AndAlso quantity <= 99 Then discountPercentage = 40 ElseIf quantity >= 100 Then
discountPercentage = 50
End If

‘ Calculate discount amount and total purchase amount
discountAmount = (discountPercentage / 100) * retailPrice
totalAmount = retailPrice – discountAmount

‘ Display the results
MessageBox.Show(“Discount amount: $” & discountAmount & vbCrLf & “Total purchase amount: $” & totalAmount)

In this implementation, the user is prompted to enter the number of packages purchased using the InputBox function, and the results are displayed using the MessageBox.Show function.

Need your ASSIGNMENT done? Use our paper writing service to score better and meet your deadline.


Click Here to Make an Order Click Here to Hire a Writer