You are writing code for a KINKOS class. The KINKOS class contains the name and
price of a product. You need to override the base class (System.Object) method ToString
to provide information about the objects of the KINKOS class to the calling code. What
code do you need to write in order to meet this requirement?
1
Expert's answer
2014-11-11T00:42:54-0500
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace quest48752 { class Program { class KINKOS { public string Name { get; set; } public int Price { get; set; } public override string ToString() { return "Name: " + Name + " Price of product : " + Price; } } static void Main(string[] args) { Console.Write("Enter the name : "); string name = Console.ReadLine(); Console.Write("Enter the price of prodect : "); int price = Convert.ToInt32( Console.ReadLine() ); KINKOS kinkos = new KINKOS { Name = name, Price = price }; Console.WriteLine(kinkos); Console.ReadLine(); } } }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment