Assignment 10 Due Wednesday, February 14 at 9:20am on Canvas Assignment 10.1: Buying More Pastries (10 pts) Let's alter it to also print a receipt at the bottom of the order. Each pastry will also now need a price displayed to the user. Assume each pastry is priced according to the following table:
Assignment 10.2: Weight in Space (10 pts)
if (//test for planet name) { weight = weight * MERCURY_MULT; } else if (//test for a second planet name) { //statement goes here } //rest of else ifs go here } else { //ERROR CHECKING! }
const double MERCURY_MULT = 0.38;
#include <iostream> #include <iomanip> using namespace std; int main() { if (test condition) { //statements } else if { //statements } else if { //statements } else { //statements } }
Welcome! What do you weigh on other planets? Enter your weight in pounds: 123 Now, select from one of the following planets: Mercury Venus Mars Jupiter Saturn Uranus Neptune Pluto Please enter the planet: mercury You weigh 46.7 lbs on Mercury
Welcome! What do you weigh on other planets? Enter your weight in pounds: 189 Now, select from one of the following planets: Mercury Venus Mars Jupiter Saturn Uranus Neptune Pluto Please enter the planet: Neptune You weigh 224.9 lbs on Neptune
Welcome! What do you weigh on other planets? Enter your weight in pounds: 147 Now, select from one of the following planets: Mercury Venus Mars Jupiter Saturn Uranus Neptune Pluto Please enter the planet: Marz You entered an invalid planet name. Please rerun the program to try again. |