Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions