194k views
4 votes
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 restaurant charge, before taxes. Produce output showing the calculated values including the total amount due for both 15% and the 20% tips. Tax of 9% should be added to the bill before the tip is determined. Write appropriate methods for your solution. Display subtotal showing the amount owed prior to applying a tip. Show each tip amount and the totals with each tip amount. Be sure to provide labels for values and number align them.

User Asleep
by
7.6k points

1 Answer

2 votes

Answer:

using System;

public class Test

{

public static void Main()

{

// your code goes here

Console.Write("\\Enter the total bill : ");

double totalbeforetax = Convert.ToDouble(Console.ReadLine());

Console.Write("\\Enter the tip percentage(10% or 15%) : ");

double tip = Convert.ToDouble(Console.ReadLine());

double totalwithtax = totalbeforetax*(1+0.09);

double tipamount = tip*totalwithtax/100;

double total = totalwithtax + tipamount;

Console.WriteLine("\\Total bill without tax: "+totalbeforetax);

Console.WriteLine("\\Total bill with 9% tax: "+totalwithtax);

Console.WriteLine("\\Tip Amount: "+tipamount);

Console.WriteLine("\\Total bill with tax and tip: "+total);

}

}

Step-by-step explanation:

User Rebitzele
by
7.3k points