Solution to a. (overSpeed > 10) ? fine = 200 : fine = 75; b. (fuel >= … - Sikademy
Author Image

Archangel Macsika

a. (overSpeed > 10) ? fine = 200 : fine = 75; b. (fuel >= 10) ? drive = 150 : drive = 30; c. (bill >= 50.00) ? tip = 0.20 : tip = 0.10;

The Answer to the Question
is below this banner.

Can't find a solution anywhere?

NEED A FAST ANSWER TO ANY QUESTION OR ASSIGNMENT?

Get the Answers Now!

You will get a detailed answer to your question or assignment in the shortest time possible.

Here's the Solution to this Question


#include <iostream> #include <iomanip> using namespace std; int main() { //a. (overSpeed > 10) ? fine = 200 : fine = 75; int overSpeed, fine; cout << "Please, enter an overspeed: "; cin >> overSpeed; if (overSpeed > 10) fine = 200; else fine = 75; cout << "fine = " << fine << endl; //b. (fuel >= 10) ? drive = 150 : drive = 30; int fuel, drive; cout << "Please, enter a fuel: "; cin >> fuel; if (fuel >=10) drive = 150; else drive = 30; cout << "drive = " << drive << endl; //c. (bill >= 50.00) ? tip = 0.20 : tip = 0.10 float bill, tip; cout << "Please, enter a bill: "; cin >> bill; if (bill >= 50.00) tip = 0.20; else tip = 0.10; cout << fixed << setprecision(2) << "tip = " << tip << endl; }

Related Answers

Was this answer helpful?

Join our Community to stay in the know

Get updates for similar and other helpful Answers

Question ID: mtid-3-stid-44-sqid-1034-qpid-30