Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Microsoft Visual C# 2017 page 221 Please keep these as basic as possible so that

ID: 3870249 • Letter: M

Question

Microsoft Visual C# 2017 page 221

Please keep these as basic as possible so that I can understand and follow how it was done.

11. In a “You Do It” section of this chapter, you created a tipping table for patrons to use when analyzing their restaurant bills. Now, create a modified program named TippingTable3 in which each of the following values is obtained from user input:

- The lowest tipping percentage

- The highest tipping percentage

- The lowest possible restaurant bill

- The highest restaurant bill

The result should look like this:

CAWINDOWSlsystem321cmd.exe What is the lowest tipping percentage: 10 what is the highest tipping percentage: 40 what is the lowestestaurant bill: 12.99 hat is the highest restaurant bill: 34.99 Price 0.10 0.15 0.20 0.25 0.30 .35 .40 $12.99 1.30 1.95 2.60 3.25 3.90 4.55 5.20 $22.99 2.30 3.45 4.60 5.75 6.90 8.05 9.20 $32.99 3.30 4.95 6.60 8.25 9.90 11.55 13.20 Press any key to continue .

Explanation / Answer

using System;
public class TippingTable
{
public static void Main()
{
double dinnerPrice;
double tipRate;
double tip;

double LOWRATE;
double MAXRATE;
const double TIPSTEP = 0.05;
double MAXDINNER;
const double DINNERSTEP = 10.00;
  
Console.Write("What is lowest tipping percentage ");
LOWRATE = Convert.ToDouble(Console.ReadLine());
  
Console.Write("What is Highest tipping percentage ");
MAXRATE = Convert.ToDouble(Console.ReadLine());
  
Console.Write("What is lowest restaurent bill ");
dinnerPrice = Convert.ToDouble(Console.ReadLine());
  
Console.Write("What is highest restaurent bill ");
MAXDINNER = Convert.ToDouble(Console.ReadLine());
  

Console.Write(" Price");
for(tipRate = LOWRATE; tipRate <= MAXRATE;
tipRate += TIPSTEP)
Console.Write("{0, 8}" , tipRate.ToString("F"));
Console.WriteLine();
Console.WriteLine("----------------------------------------");

tipRate = LOWRATE;

while (dinnerPrice <= MAXDINNER)
{
Console.Write("{0, 8}", dinnerPrice);
while (tipRate <= MAXRATE)
{
tip = dinnerPrice * tipRate;
Console.Write("{0, 8}",tip.ToString("F"));
tipRate += 0.05;
}
dinnerPrice += DINNERSTEP;
tipRate = LOWRATE;
Console.WriteLine();
}
}
}