Question

In: Computer Science

========================================================================= A software company sells a package that retails for $99. Quantity discounts are given according...

=========================================================================

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%
Write a program that asks for the number of units sold and computes the total cost of
the purchase.
Input Validation: Make sure the number of units is greater than 0.

=========================================================================

the pseudo code is:

There comes situations in real life when we need to make some decisions and based on these decisions, we decide what should we do next. Similar situations arises in programming also where we need to make some decisions and based on these decision we will execute the next block of code. Decision making statements in programming languages decides the direction of flow of program execution.

Decision making structures require that the programmer specify one or more conditions to be evaluated or tested by the program selection construct, along with a statement or statements to be executed if the condition is determined to be true, and optionally, other statements to be executed if the condition is determined to be false.

When a customer purchases some quantity of our software package, we need to make a decision about how much discount to apply to the purchase. Our program will need to evaluate at least 4 to 5 conditions to determine which discount to apply.

We will use a decision making structure that can evaluate at test for five(5) possible conditions along with a statement to apply the discount if the condition is determined to be true.

Since we have multiple conditions to evaluate, we shall select to implement the if-else-if ladder construct which has the following syntax:

if (condition)
statement;
else if (condition)
statement;
.
.
else
statement;
=========================================================================
declare const for price
double const PRICE(99.00);

declare variables
int qty, double totalCost, discount

prompt user for qty

validate data & determine discount

if( qty <= 0 ) cout<<"Invalid Value\n"

else if( qty < 20 ) discount = 0.20

.
.
else discount = 0.50

compute totalCost

display results

----------------------------------------------------------------------------

Solutions

Expert Solution

Code

#include<iostream>

using namespace std;

int main()
{
   double const PRICE=99.00;
   int qty;
   double totalCost, discount=0.0;
   cout<<"How many computer product sold: ";
   cin>>qty;
      
   if( qty <= 0 )
   {
           cout<<"Invalid Value\n";
           return 0;
   }
   else if( qty < 20 ) discount = 0.20;
   else if(qty<50) discount=0.30;
   else if(qty<100) discount=0.40;
   else discount=0.50;

   totalCost=(qty*PRICE)-((qty*PRICE)*discount);

   cout<<"Total cost is : $"<<totalCost<<endl;

   return 1;
}

output

If you have any query regarding the code please ask me in the comment i am here for help you. Please do not direct thumbs down just ask if you have any query. And if you like my work then please appreciates with up vote. Thank You.


Related Solutions

Task #1 – Software Sales A software company sells a package that retails for $99. Quantity...
Task #1 – Software Sales A software company sells a package that retails for $99. Quantity discounts are given according to the following: Quantity Discount 1 - 9 NO DISCOUNT 10 – 19 20% 20 – 49 30% 50 – 99 40% 100 or more 50% Your program calculates the final purchase price of the software packages based on the quantity purchased. If a value of 0 or less (a negative number) is entered, display the message “Invalid Quantity” and...
CODE IN JAVA A computer company sells software and computer packages for $75. Quantity discounts are...
CODE IN JAVA A computer company sells software and computer packages for $75. Quantity discounts are given based on the following criteria: Quantity          Discount 10 - 19             20% 20 - 49             30% 50 - 99             40% 100 or more    50% Be sure the user is presented with all necessary information, then prompt the user for the quantity of packages. Display the total cost of the purchase making sure to apply appropriate discounts. Example Output: Demon software and computers is offering...
Software Sales A software company sells three packages, Package A, Package B, and Package C, which...
Software Sales A software company sells three packages, Package A, Package B, and Package C, which retail for $99, $199, and $299, respectively. Quantity discounts are given according to the following table: Quantity Discount 10 through 19 20% ,20 through 49 30% ,50 through 99 40% ,100 or more 50% . Create a C++ program that allows the user to enter the number of units sold for each software package. The application should calculate and display the order amounts and...
Design the logic in pseudocode for Bugz App software company that sells a software package as...
Design the logic in pseudocode for Bugz App software company that sells a software package as follows. 1. The retail price of the package is $99 2. Quantity discounts are given on purchases of 10 or more units as follows The program must allow the user to enter the customer’s name and number of units purchased, and output the original cost of the units purchased, the percentage discount given, the dollar amount of the discount given, and the final cost...
A company sells a product for a retail price of $100. It offers quantity discounts based...
A company sells a product for a retail price of $100. It offers quantity discounts based on the table below Quantity Discount 10-19 10% 20-49 20% 50-99 30% 100 or more 40% Write a program that asks user for enter the quantity of product they want to purchase. It should then display the discount amount (if any) and the total purchase amount after the discount. The output should be displayed with 2 decimal points as shown below. See a sample...
this is in excel VB8 Program 2: Software Sales A software company sells three packages, Package...
this is in excel VB8 Program 2: Software Sales A software company sells three packages, Package A, Package B, and Package C, which retail for $99, $199, and $299, respectively. Quantity discounts are given according to the following table: Quantity Discount 10 through 19 20% 20 through 49 30% 50 through 99 40% 100 or more 50% Create an application that allows the user to enter the number of units sold for each software package. The application should calculate and...
Early in 2021, the Excalibur Company began developing a new software package to be marketed. The...
Early in 2021, the Excalibur Company began developing a new software package to be marketed. The project was completed in December 2021 at a cost of $102 million. Of this amount, $68 million was spent before technological feasibility was established. Excalibur expects a useful life of five years for the new product with total revenues of $170 million. During 2022, revenue of $51 million was recognized. Required: 1. Prepare a journal entry to record the 2021 development costs. 2. Calculate...
Classification of Cryptocurrency Holdings (Adapted) Software Provider (the “Company”) supports and sells computer software. The Company...
Classification of Cryptocurrency Holdings (Adapted) Software Provider (the “Company”) supports and sells computer software. The Company accepts cryptocurrencies (e.g., Bitcoin, Ether, Ripple) as payment for the sale of its computer software. The Company holds its cryptocurrencies partially for investment (e.g., expectation that they will appreciate in value) and partially to use in the future to purchase goods or services. Cryptocurrency is a new type of value and payment method that is different from fiat currency (e.g., U.S. dollars and foreign...
The Cre8tor™ is in need of an office management software package. After considerable research, the company...
The Cre8tor™ is in need of an office management software package. After considerable research, the company has narrowed its choice to one of three packages: N-able, VersaSuite, and SoftTrack. They have determined the decision-making criteria, assigned a weight to each criterion, and rated how well each alternative satisfies each criterion as follows Decision Alternatives Criterion Weight N-Able VersaSuite SoftTrack Ease of use 4 5 7 6 Report generation 3 7 5 4 Functional integration 5 8 6 5 On-line help...
A company typically sells 100,000 units at $10 per unit. It runs a promotion that discounts...
A company typically sells 100,000 units at $10 per unit. It runs a promotion that discounts each unit by $3 per unit. To promote the discount, the company pays a flat fee of $50,000. The company sells 50,000 additional units in incremental sales. What is the cost of this promotion? Should the company proceed with this promotion and discount? Why or why not?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT