Complete the algorithm table to calculate a tip to leave a waiter. The program s
ID: 3843978 • Letter: C
Question
Complete the algorithm table to calculate a tip to leave a waiter. The program should subtract the liquor and 7% tax from the total bill and then calculate the tip (using a percentage) on the remainder. The user will enter the total bill, liquor amount, and tip percent. Desk check using $100 as total bill, $20 for liquor, and a 20% tip. When finished submit this document (not zipped) into Blackboard and submit hard copy in class. Field names are descriptive names in camel case.
See Sample Algorithm table.
for C#
Explanation / Answer
Program in C# for tip
using System;
public class Bill
{
double total_bill, liquor, tip, tip_amount;
public static void Main()
{
Bill bill = new Bill();
bill.Input();
bill.tip_amount = (bill.total_bill - (bill.liquor + (bill.total_bill*0.07) ))*(bill.tip/100);
Console.WriteLine("Tip = {0}",bill.tip_amount);
}
public void Input(){
Console.WriteLine("Enter the total bill : ");
total_bill = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter the liquor amount : ");
liquor = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter the tip in % : ");
tip = Convert.ToDouble(Console.ReadLine());
}
}
If you require algorithm instead then notify in comment
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.