Write a program that reads the subtotal and the gratuity rate for a service. Compute the gratuity and the total. For example, if the user enters 10 for the subtotal and 15% as the gratuity rate, the program displays $1.5 as the gratuity and $11.5 as total.

Respuesta :

Answer:

# include<iostream>

#include<conio.h>

using namespace std;

main()

{

float subtotal, gratuityrate, total, gratuity;

cout<<"enter the value of subtotal amount = ";

cin>>subtotal;

cout<<"/nPercentage gratuity rate = ";

cin>>gratuityrate;

gratuity = gratuity / subtotal;

total = gratuity + subtotal;

Cout<<"/nGratuity = "<< gratuity;

Cout<<"/nTotal = "<<total;

getch();

}

Explanation:

In this program, four variable has been taken in float datatype variables to enter or calculate values in decimal. Then take two user defined values gratuity rate and subtotal. By using formula, calculate the gratuity and total amount.

ACCESS MORE