+ 5
[Solved] What's wrong with my C# social network code coach snippet?
11 Respostas
0
Post has to be lower case, that's all
+ 23
using System;
using System.Collections.Generic;
namespace Code_Coach_Challenge
{
class Program
{
static void Main(string[] args)
{
string postText = Console.ReadLine();
Post post = new Post();
post.Text = postText;
post.ShowPost();
}
}
class Post
{
private string text;
public Post() {
Console.WriteLine("New post");
}
public void ShowPost()
{
Console.WriteLine(text);
}
public string Text {
get {return text;}
set {text = value;}
}
}
}
+ 5
using System;
using System.Collections.Generic;
namespace Code_Coach_Challenge
{
class Program
{
static void Main(string[] args)
{
string postText = Console.ReadLine();
Post post = new Post();
post.Text = postText;
post.ShowPost();
}
}
class Post
{
private string text;
public Post() {
Console.WriteLine("New post");
}
public void ShowPost()
{
Console.WriteLine(text);
}
public string Text {
get {return text;}
set {text = value;}
}
}
}
+ 2
Sonic
How is the task requirement?
+ 2
It fails the automated tests despite apparently giving the expected output.
+ 2
Ipang the requirement are in the C# tutorial End of Module Project #41. Unfortunately it doesn't allow me to post a link.
+ 2
Thanks for the answers. However, the issue has already been solved.
+ 2
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Code_Coach_Challenge
{
class Post
{
private string text;
public Post(){
Console.WriteLine("New post");
}
public void ShowPost()
{
Console.WriteLine(text);
}
public string Text {
get {return text;}
set {text = value;}
}
}
class Program
{
static void Main(string[] args)
{
string postText = Console.ReadLine();
Post post = new Post();
post.Text = postText;
post.ShowPost();
}
}
}
+ 1
Benjamin JĂŒrgens OMG! Thank you. I completely missed that.
+ 1
Ipang it was just incorrect case in the output message.
+ 1
using System;
using System.Collections.Generic;
namespace Code_Coach_Challenge
{
class Program
{
static void Main(string[] args)
{
string postText = Console.ReadLine();
Post post = new Post();
post.Text = postText;
post.ShowPost();
}
}
class Post
{
private string text;
//write a constructor here
public Post() {
Console.WriteLine("New post");
}
public void ShowPost()
{
Console.WriteLine(text);
}
//write a property for member text
public string Text {
get {return text;}
set {text = value;}
}
}
}