Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is C++ programming freezes on: 09/13/201 ORK AREA CHAPTER 2, Exercise *2.5

ID: 3743180 • Letter: T

Question

This is C++ programming

freezes on: 09/13/201 ORK AREA CHAPTER 2, Exercise *2.5 (Financial application: calculate tips) 2.5: Write a program that calculates the tips. The program will first read the subtotal and the gratuity rate, and then will display the tip and total. The tip is calculated as follows: subtotal times gratuity rate divided by 100, and the total is tip plus subtotal. SAMPLE RUN # 1 : ./tip-B Interactive Session Hide Invisible Highlight: None Show Highlighted OnlyD Enter the subtotal and.a.gratuity-rate:10.15 The gratuity is.$1.5-and.total-is $11.5 SUBMIT 1 of 1 ed sep 05 2018 10:37:10 GMT-0700 (Pacific Daylight Time) ' i l Type your solution here...

Explanation / Answer

#include <iostream>

using namespace std;

int main() {

double subtotal, gratuity;

cout << "Enter the subtotal and a gratuitu rate: ";

cin >> subtotal;

cin >> gratuity;

double tip, total;

tip = subtotal*gratuity/100.0;

total = tip + subtotal;

cout << "The gratuity is $" << tip << " and total is $" << total << endl;

}

/*SAMPLE OUTPUT

Enter the subtotal and a gratuitu rate: 10 15

The gratuity is $1.5 and total is $11.5

*/

#include <iostream>

using namespace std;

int main() {

int number;

cout << "Enter an integer between 0 and 1000: ";

cin >> number;

int total = 0;

while(number > 0)

{

total = total + (number%10);

number = number / 10;

}

cout << "The sum of the digits is: " << total << endl;

}

/*SAMPLE OUTPUT

*/

// Hit the thumbs up if you are fine with the answer. Happy Learning!

#include <iostream>

using namespace std;

int main() {

double subtotal, gratuity;

cout << "Enter the subtotal and a gratuitu rate: ";

cin >> subtotal;

cin >> gratuity;

double tip, total;

tip = subtotal*gratuity/100.0;

total = tip + subtotal;

cout << "The gratuity is $" << tip << " and total is $" << total << endl;

}

/*SAMPLE OUTPUT

Enter the subtotal and a gratuitu rate: 10 15

The gratuity is $1.5 and total is $11.5

*/

#include <iostream>

using namespace std;

int main() {

int number;

cout << "Enter an integer between 0 and 1000: ";

cin >> number;

int total = 0;

while(number > 0)

{

total = total + (number%10);

number = number / 10;

}

cout << "The sum of the digits is: " << total << endl;

}

/*SAMPLE OUTPUT

  Enter an integer between 0 and 1000:  932  The sum of the digits is: 14 

*/

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote