+ 1
Can anybody try to work this out please ? I don't know if the request itself is valid or not.
#Csharp Track - Assignment 5 : Create a C# program that implements an abstract class Animal that has a Name property of type text and three methods SetName (string name), GetName, and Eats. The Eat method will be an abstract method of type void. You will also need to create a Dog class that implements the above Animal class and the Eat method that says the dog is Eating. To test the program ask the user for a dog name and create a new Dog type object from the Home controller Index Action of the application, give the Dog object a name, and then execute the GetName and Eat methods.
11 odpowiedzi
+ 3
Please do not re-post the same question. You can post in your existing thread if you want to add something.
As already mentioned, show your code so we can check on it. We are not going to do your homework for you.
https://www.sololearn.com/Discuss/3060368/?ref=app
+ 3
Please rather save it as new code bit and attach the code bit link in your post Description. It's relatively easier to check, copy/paste hassle-free, and line number reference is supported when it's in a code bit.
+ 2
I see you posted and reposted this topic several times today. I also saw some people came to answer your previous post. Which part of it that you're still struggling with after getting some suggestions?
P.S. Don't forget to attach your code bit link in post Description. It helps improve your chances for answers cause people see you've put an effort in.
https://www.sololearn.com/post/75089/?ref=app
+ 2
There's no way to join a string and void, they are too different there's just no way to go about it.
What kind of output was expected? was that illustrated in task Description? perhaps it may help others to understand your situation better ...
+ 1
Ipang To test the program ask the user for a dog name and create a new Dog type object from the Home controller Index Action of the application, give the Dog object a name, and then execute the GetName and Eat methods.
This is the passage that is supposed to include the output , Honestly I don't clearly understand what the engineer wants .
I googled the whole problem and found exactly the same problem but he made some modifications to it .
+ 1
Did it help if you follow the guy's way with modification? perhaps it's okay to stray a bit while the code works and gives output as expected ...
0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Csharp_Assignment_5
{
public abstract class Animal
{
public string Name { get; set; }
public abstract void Eat();
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Csharp_Assignment_5
{
public class Dog : Animal
{
public override void Eat()
{
Console.WriteLine("The Dog is eating");
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Csharp_Assignment_5.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
Dog dog = new Dog();
dog.Name = "Jaja";
return Content("The Dog name is " + dog.Name + dog.Eat());
}
public ActionResult About()
{
ViewBag.Message = "Your application description page.";
return View();
}
public ActionResult Contact()
{
ViewBag.Message = "Your contact page.";
return View();
}
}
}
@{
ViewBag.Title = "Home Page";
}
0
I struggle with concatenating a void to a string @Ipang
0
Ipang Also the website of the app is not very helpful , I can copy the code from Visual Studio to the site
0
Lisa I pasted the code in the comments , The problem is the web site is not helpful , and the code is on my laptop .
0
Ipang Sorry for this hussle but the whole problem itself is vague to me .