here is the core of the program: (the whole progam is in a txt file attached)
Expand|Select|Wrap|Line Numbers
- public static void Main()
- {
- CoffeeTableBook aGoodCTB = new CoffeeTableBook();
- aGoodCTB.Isbn = "9780712614894 ";
- aGoodCTB.Title = "Interior Design with Feng Shui";
- aGoodCTB.Author = "Sarah Rossbach";
- aGoodCTB.Price = 48.75;
- Console.WriteLine("\nISBN: {0}", aGoodCTB.Isbn);
- Console.WriteLine(" {0} by {1} sells for {2}",
- aGoodCTB.Title, aGoodCTB.Author,
- aGoodCTB.Price.ToString("C"));
- }
- public class Book
- {
- private string isbn;
- private string title;
- private string author;
- protected double price;
- public string Isbn { get; set; }
- public string Title { get; set; }
- public string Author { get; set; }
- public double Price { get; set; }
- }
- public class CoffeeTableBook : Book
- {
- public const double LOWPRICE = 35.00;
- public const double HIGHPRICE = 100.00;
- new public double Price
- {
- get
- {
- return base.Price;
- }
- set
- {
- if (value < LOWPRICE)
- price = LOWPRICE;
- else if (value > HIGHPRICE)
- price = HIGHPRICE;
- else price = value;
- }
- }