provided file has syntax and/or logical errors
Microsoft Visual C# 7th edition, debugging 9-2
Instruction: The provided file has syntax and/or logical errors. Determine the problem(s) and fix the program.
// Creates a Breakfast class
// and instantiates an object
// Displays Breakfast special
using System;
using static System.Console;
using System.Globalization;
class DebugNine2
{
static void Main()
{
Breakfast special = new Breakfast("French toast, 4.99);
//Display the info about breakfast
WriteLine(INFO);
// then display today's special
WriteLine("Today we are having {1} for {1}",
special.name, special.Price.ToString("C2", CultureInfo.GetCultureInfo("en-US")));
}
}
class Breakfast
{
public string INFO =
"Breakfast is the most important meal of the day.";
// Breakfast constructor requires a
// name, e.g "French toast", and a price
public Breakfast(string name, double price)
{
name = name;
price = price;
}
public string Name {get; set}
public double Price {get; set}
}
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images