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

Paste the code in the answer and a screenshot of the output Programming Challeng

ID: 3586038 • Letter: P

Question

Paste the code in the answer and a screenshot of the output

Programming Challenge: A software company sells a package that retails for $99. Quantity discounts are given according to the following table: Discount 20% 30% 40% 50% Quantity 10-19 20-49 50-99 100 or more Write 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. What to submit: Submit your .cpp file and screenshot of your sample Input and output.

Explanation / Answer

#include <iostream>
using namespace std;
int main()
{
int packageCost = 99;
int n;
int discount;
cout<<"Enter the number of packages perchased: "<<endl;
cin >> n;
if(n >= 100) {
discount = 50;
} else if(n >=50 && n <100 ) {
discount = 40;
} else if(n >=20 && n <50 ) {
discount = 30;
} else {
discount = 20;
}
double discountAmount = (n * packageCost * discount ) /(double)100;
double totalAmount = (n * packageCost) - discountAmount;
cout<<"Discount: "<<discountAmount<<endl;
cout<<"Total Amount: "<<totalAmount<<endl;
return 0;
}

Output: