I am having trouble with this C# Programming Assignment. Although the code shown in the first picture has no error while

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

I am having trouble with this C# Programming Assignment. Although the code shown in the first picture has no error while

Post by answerhappygod »

I am having trouble with this C# Programming Assignment.
Although the code shown in the first picture has no error whilerunning it, I keep getting this error message every time I turn itin to the task check.
I Am Having Trouble With This C Programming Assignment Although The Code Shown In The First Picture Has No Error While 1
I Am Having Trouble With This C Programming Assignment Although The Code Shown In The First Picture Has No Error While 1 (95.54 KiB) Viewed 56 times
The error message is shown in these next two pictures.
I Am Having Trouble With This C Programming Assignment Although The Code Shown In The First Picture Has No Error While 2
I Am Having Trouble With This C Programming Assignment Although The Code Shown In The First Picture Has No Error While 2 (169.23 KiB) Viewed 56 times
I Am Having Trouble With This C Programming Assignment Although The Code Shown In The First Picture Has No Error While 3
I Am Having Trouble With This C Programming Assignment Although The Code Shown In The First Picture Has No Error While 3 (88.23 KiB) Viewed 56 times
Programming Exercise 9-2 Instructions 55 Create an application named (es/ClassifiedAd that instantiales and displays at least two Classified Ad objects. A Classified Ad has fields for a Category (For example, Used Cars and Help Wanted), a number of Words, and a price. Include properties that contain get and set accessors for the category and number of words, but only a get accessor for the price. The price is calculated at nine cents per word. Note: Your output should be formatted as: The classified ad with 100 words in category Used Cars costs $9.00 The classified ad with 60 words in category Help Wanted costs $5.40 In order to prepend the $ to currency values, the program will need to use the CultureInfo.GetCultureInfo method. In order to do this, include The statement using System.Globalization; al the top of your program and format the output statements as follows: WriteLine("This is an example: {0}", value.ToString("C", Culture Info.GetCulture Info("en-US"))); Grading When you have completed your program, click the Submit button to record your score. TestClassifiedAd.cs using static System.Console; 2 3 public class TestClassifiedAd 5 6 7 8 9 10 11 12 13 14 15 16 17 18} 24 25 26 27 28 + 29] 30 public static void Main() { } Classifiedad ad1 = new ClassifiedAd(); adl.Category= "Used Cars"; ad1.NumWords = 100; Classified Ad ad2 = new ClassifiedAd(); ad2.Category= "Help Wanted"; ad2.NumWords = 60; 19 20 class Classified Ad 21 { 22 23 WriteLine("The classified ad with {0} words in category {1} costs ${2:F2}", adl.NumWords, adl. Category, adl.Price); WriteLine("The classified ad with {0} words in category {1} costs ${2:F2}", ad2. NumWords, ad2. Category, ad2.Price); public string Category { get; set; } public int NumWords get; set; ) public double Price T J get return NumWords 0.09; }
Checks Unit TestIncomplete ClassifiedAd class test Build Status Build Failed Build Output Compilation failed: 4 error(s), 0 warnings NtTest5dec0dba.cs (15,22): error CS1061: Type `ClassifiedAd' does not contain a definition for 'Words' and no extension method 'Words' of type `ClassifiedAd' could be found. Are you missing an assembly reference? TestClassified Ad.cs(20,7): (Location of the symbol related to previous error) NtTest5dec0dba.cs(17,24): error CS1061: Type `ClassifiedAd' does not contain a definition for 'Words' and no extension method 'Words' of type `ClassifiedAd' could be found. Are you missing an assembly reference? TestClassifiedAd.cs(20,7): (Location of the symbol related to previous error) NtTest5dec0dba.cs(20,44): error CS1061: Type `ClassifiedAd' does not contain a definition for 'Words' and no extension method 'Words' of type 'Classified Ad' could be found. Are you missing an assembly reference? TestClassified Ad.cs(20,7): (Location of the symbol related to previous error) NtTest5dec0dba.cs (22,44): error CS1061: Type `ClassifiedAd' does not contain a definition for 'Words' and no extension method 'Words' of type 'ClassifiedAd' could be found. Are you missing an assembly reference? TestClassifiedAd.cs(20,7): (Location of the symbol related to previous error)
Test Contents [TestFixture] public class Classified AdClass Test { [Test] public void ClassifiedAdTest() { ClassifiedAd myClassifiedAd = new ClassifiedAd(); ClassifiedAd yourClassifiedAd = new ClassifiedAd(); myClassified Ad.Category = "Used cars"; myClassified Ad.Words = 100; your ClassifiedAd.Category = "Help wanted"; your Classified Ad.Words = 60; Assert.AreEqual("Used cars", myClassified Ad.Category); Assert.Are Equal (100, myClassifiedAd.Words); Assert.AreEqual("Help wanted", yourClassifiedAd.Category);| Assert.AreEqual (60, yourClassifiedAd.Words);
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply