107 449
Assignments Done
96%
Successfully Done
In May 2023

# Answer to Question #266671 in C# for Israel

Question #266671

Write a program that can be used to determine the tip amount that should be added to a restaurant charge. Allow the user to input the total, before taxes and the tip percentage (15% or 20%). Produce output showing the calculated values including the total amount due for both the 15% and the 201% tips. Tax of 9% should be added to the bill before the tip is determined. Display subtotal showing the amount owed prior to applying the tip, show each tip amount and the totals with each tip amount. Be sure to provide labels for values and the totals with each tip amount. Write appropriate methods for your solution.

1
2021-11-18T06:46:35-0500
using System;
using System.Collections.Generic;

namespace App
{
class Program
{

static double calculateTip15(double billAmount)
{
return billAmount * 0.15;
}
static double calculateTip20(double billAmount)
{
return billAmount * 0.2;
}

static double calculateTax(double billAmount)
{
return billAmount * 0.09;
}

static void Main(string[] args)
{
Console.Write("Enter the bill amount: ");
double billAmount = double.Parse(Console.ReadLine());
double tax = calculateTax(billAmount);
double subtotal = billAmount + tax;
double tip15 = calculateTip15(subtotal);
double tip20 = calculateTip20(subtotal);
double totalAmountDue = subtotal + tip15 + tip20;

Console.WriteLine("\nThe subtotal (the amount owed prior to applying the tip): {0}", subtotal.ToString("C"));
Console.WriteLine("Tax of 9%: {0}", tax);
Console.WriteLine("The total amount due for the 15% tips: {0}", tip15.ToString("C"));
Console.WriteLine("The total amount due for the 20% tips: {0}", tip20.ToString("C"));
Console.WriteLine("The total amount due: {0}", totalAmountDue.ToString("C"));

}
}
}

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!