C++ He Exercise attached: Write a program that reads in the cost of an order (possibly a decimal like 48.99) and the shipping method as a number (1 for Drone, 2 for 2-Day and 3 for Standard) and prints out the total cost of the order + shipping. Do not worry about formatting the money to look like money - if you want to, the program in chapter 3.8 has a trick that will work until you learn the "real" way. If the user enters a negative cost or a different shipping method, print out "Bad Input". If they pick Drone with an order under $100 you should just print "Not available"
Where did you have a problem with this.
I'm taking this online and really struggling. I am not sure where to go with putting in the different types of methods and the IF statements
Here is the problem:
I started here but like I said completely lost. Any help is apprecia #include <iostream> using namespace std; int main() { //Prompt the user to enter the cost of their order cout << "Enter the cost of your order: "; double cost cin >> cost //Prompt the user to enter their shipping method cout << "Enter the shipping method: "; double method; cin >> method; //Display result cout << "Total is " cost if (cost <100) return 0; } ted.
Because of the linear nature of you program, check for the bad results first. So deal with this first: If the user enters a negative cost or a different shipping method, print out "Bad Input".
Then you can test for which method and add to the total based on it, but you have another exception in there to take care of, the <100 one.
Join our real-time social learning platform and learn together with your friends!