Asked by Helmet
Write a program that allows the user to enter a product code that consists of five or six characters. The second and third characters represent the delivery method, as follows: “DHL” represents “DHL”, “AMP” represents “Air – Mail-Priority”, “FES” represents “FedEx – Standard”, “FEO” represents “FedEx – Overnight”, and “UPS” represents “UPS”. Display an appropriate message when the part number does not contain either five or six characters. Also display an appropriate message when the third, fourth and fifth characters are not one of the delivery methods. If the part number is valid, the program should display the delivery method.
Answers
Answered by
jone ravu
int maxOrder[] = {10, 50, 100, 99999};
int shipCharge[] = {10, 15, 5, 0};
String input;
int numOrdered;
cout << "Enter the number ordered(or stop to end the program): "'
cin >> input;
while (input != "stop")
{
numOrdered = (int)input;
if (numOrdered <= maxOrdre[0])
cout << "Shipping charge is << shipCharge[0] * numOrdered << endl << endl;
else if (numOrdered <= maxOrdre[1])
cout << "Shipping charge is << shipCharge[1] * numOrdered << endl << endl;
else if (numOrdered <= maxOrdre[2])
cout << "Shipping charge is << shipCharge[2] * numOrdered << endl << endl;
else if (numOrdered <= maxOrdre[3])
cout << "Shipping charge is << shipCharge[3] * numOrdered << endl << endl;
cout << "Enter the number ordered(or "stop" to end the program): "'
cin >> input;
}
int shipCharge[] = {10, 15, 5, 0};
String input;
int numOrdered;
cout << "Enter the number ordered(or stop to end the program): "'
cin >> input;
while (input != "stop")
{
numOrdered = (int)input;
if (numOrdered <= maxOrdre[0])
cout << "Shipping charge is << shipCharge[0] * numOrdered << endl << endl;
else if (numOrdered <= maxOrdre[1])
cout << "Shipping charge is << shipCharge[1] * numOrdered << endl << endl;
else if (numOrdered <= maxOrdre[2])
cout << "Shipping charge is << shipCharge[2] * numOrdered << endl << endl;
else if (numOrdered <= maxOrdre[3])
cout << "Shipping charge is << shipCharge[3] * numOrdered << endl << endl;
cout << "Enter the number ordered(or "stop" to end the program): "'
cin >> input;
}
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.