Explore Westonci.ca, the top Q&A platform where your questions are answered by professionals and enthusiasts alike. Connect with a community of experts ready to help you find accurate solutions to your questions quickly and efficiently. Get detailed and accurate answers to your questions from a dedicated community of experts on our Q&A platform.
Sagot :
Answer:
The program in C++ is as follows:
#include <iostream>
using namespace std;
int main(){
int qty;
float discount = 0;
cout<<"Quantity: ";
cin>>qty;
int cost = qty * 100;
[tex]i f (cost > 1000)[/tex] { [tex]discount=cost * 0.10[/tex]; }
cout<<"Cost: "<<cost - discount;
return 0;
}
Explanation:
This declares the quantity as integer
int qty;
This declares and initializes discount to 0
float discount = 0;
This prompts the user for quantity
cout<<"Quantity: ";
This gets input for quantity
cin>>qty;
This calculates the cost
int cost = qty * 100;
If cost is above 1000, a discount of 10% is calculated
[tex]i f (cost > 1000)[/tex] { [tex]discount=cost * 0.10[/tex]; }
This prints the cost
cout<<"Cost: "<<cost - discount;
Thanks for using our service. We're always here to provide accurate and up-to-date answers to all your queries. We hope our answers were useful. Return anytime for more information and answers to any other questions you have. We're dedicated to helping you find the answers you need at Westonci.ca. Don't hesitate to return for more.