Question: Visual Studio Set a breakpoint in the model class and step through its code to find the error that leads to the app calculating an

Visual Studio

Set a breakpoint in the model class and step through its code to find the error that leads to the app calculating an incorrect tip amount.

tipcalculator.cs:

using System.ComponentModel.DataAnnotations;

namespace TipCalculator.Models { public class Calculator { [Required(ErrorMessage = "Please enter a value for cost of meal.")] [Range(0.0, 10000000.0, ErrorMessage = "Cost of meal must be greater than zero.")] public double? MealCost { get; set; }

public double CalculateTip(double percent) { if (MealCost.HasValue) { var tip = MealCost.Value / percent; return tip } else { return 0; } } } }

site.css:

body { padding: 1em; font-family: Arial, Arial, Helvetica, sans-serif; }

h1 { margin-top: 0; color: navy; }

label { display: inline-block; widht: 10em; padding-right: 1em; }

div { margin-bottom: .5em; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!