At Westonci.ca, we provide clear, reliable answers to all your questions. Join our vibrant community and get the solutions you need. Our platform offers a seamless experience for finding reliable answers from a network of experienced professionals. Connect with a community of professionals ready to provide precise solutions to your questions quickly and accurately.
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;
We appreciate your time on our site. Don't hesitate to return whenever you have more questions or need further clarification. We appreciate your time. Please come back anytime for the latest information and answers to your questions. Get the answers you need at Westonci.ca. Stay informed with our latest expert advice.