Answer to Question #256007 in C# for Umar farouk

Question #256007
5.Write a program that reads the subtotal and the gratuity rate, then computes the gratuity and total. For example, if the user enters 10 for subtotal and 15% for gratuity rate, the program displays $1.5 as gratuity and $11.5 as total.
1
Expert's answer
2021-10-26T05:09:35-0400
using System;
using System.Collections.Generic;


namespace App
{






    class Program
    {


        static void Main(string[] args)
        {


            Console.Write("Enter the subtotal: ");
            double subtotal = double.Parse(Console.ReadLine());
            Console.Write("Enter the gratuity rate: ");
            double gratuityRate = double.Parse(Console.ReadLine());
            double gratuity = subtotal * (gratuityRate/ 100.0);


            double total = subtotal + gratuity;


            Console.WriteLine("The Gratuity is : ${0}", gratuity.ToString("N2"));
            Console.WriteLine("The total is : ${0}", total.ToString("N2"));


            Console.ReadLine();
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS