Question: using System; class ClassifiedAd { / / Properties public string Category { get; set; } public int Words { get; set; } public double Price
using System; class ClassifiedAd Properties public string Category get; set; public int Words get; set; public double Price get; set; Constructor public ClassifiedAdstring category, int words Category category; Words words; Call the method to calculate and set the initial price CalPrice; Method to calculate and set the ad price public void CalPrice Calculate the price based on the number of words and category if Category "Painting" Price Words ; else if Category "Moving" Price Words ; else Default price if the category is not recognized Price Words ; class AdApp static void Main Create instances of ClassifiedAd ClassifiedAd ad new ClassifiedAdPainting; ClassifiedAd ad new ClassifiedAdMoving; Display information about the first advertisement Console.WriteLine$"What is the category of the first advertisement? adCategory; Console.WriteLine$"How many words does it have? adWords; Display information about the second advertisement Console.WriteLine$"What is the category of the second advertisement? adCategory; Console.WriteLine$"How many words does it have? adWords; Display the calculated prices Console.WriteLine$"The classified ad with adWords words in category adCategory costs $adPrice.ToStringF; Console.WriteLine$"The classified ad with adWords words in category adCategory costs $adPrice.ToStringF; Wait for user input before closing the console window Console.WriteLinePress any key to continue"; Console.ReadKey;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
