0

Please help

You are making a social network application and want to add post creation functionality. As a user creates a post, the text "New post" should be automatically outputted so that then the user can add the text he/she wants to share. The program you are given declares a Post class with a text private field, and the ShowPost() method which outputs the content. Complete the class with - a constructor, which outputs "New post" as called, - Text property, which will allow you to get and set the value of the text field. Once you have made the changes to the program so that it works correctly, then in main, the program will take the text of the post from the user, create a post object, assign the taken value to the text field and output it. Sample Input Hello! Sample Output New post Hello!

30th Jan 2021, 8:25 AM
Thakkar Heer
Thakkar Heer - avatar
23 Respostas
- 7
Sorry, we don't support plagiarism, laziness etc. First show us your try then we can help you willingly.
30th Jan 2021, 11:56 AM
Aditya
Aditya - avatar
+ 33
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;} } } }
9th Mar 2021, 10:55 AM
András Timár
András Timár - avatar
+ 8
Well I'm a beginner in c# I ought to make a method of Showpost() I tried, maybe this passes your testcases https://code.sololearn.com/c8lr68jtPrdv/?ref=app
30th Jan 2021, 2:49 PM
Aditya
Aditya - avatar
+ 6
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;} } } }
14th Sep 2021, 4:40 PM
Verjin V
Verjin V - avatar
+ 5
Your very welcome. No I'm not a genius at all! Just a learner. Happy learning, happy coding!
31st Jan 2021, 6:19 AM
Aditya
Aditya - avatar
+ 3
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; } } }
8th Sep 2021, 3:52 AM
Jobayrul Hasan
Jobayrul Hasan - avatar
+ 1
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Sololearn { class Post { string model; private Post() { model = "New post"; } static void Main(string[] args) { string str; str= Console.ReadLine(); Post Show= new Post(); Console.WriteLine(Show.model); Console.Write("{0}\n", str); } } }
7th Feb 2021, 5:35 PM
Md Momin Uddin Hridoy
Md Momin Uddin Hridoy - avatar
0
Please tell me
30th Jan 2021, 8:26 AM
Thakkar Heer
Thakkar Heer - avatar
0
Please give me the code
30th Jan 2021, 8:26 AM
Thakkar Heer
Thakkar Heer - avatar
0
This is what i wrote
30th Jan 2021, 1:51 PM
Thakkar Heer
Thakkar Heer - avatar
0
Now can you please tell
30th Jan 2021, 1:51 PM
Thakkar Heer
Thakkar Heer - avatar
0
Aditya thankyou so much you are a genius
31st Jan 2021, 6:06 AM
Thakkar Heer
Thakkar Heer - avatar
0
My result: string postText = Console.ReadLine(); Post post = new Post(); post.Text = postText; post.ShowPost(); } } class Post { private string text; public string Text { get{return text;} set{ text=value;} } public void ShowPost() { Console.WriteLine("New post"); Console.WriteLine(text); }
4th Feb 2021, 9:47 AM
Bedő Péter
Bedő Péter - avatar
0
namespace Code_Coach_Challenge { class Program { static void Main(string[] args) { Console.WriteLine("New post"); string postText = Console.ReadLine(); Post post = new Post(); post.Text = postText; post.ShowPost(); } } class Post { private string text; //write a constructor here public string Text { get { return text; } set { text = value; } } public void ShowPost() { Console.WriteLine(text); } //write a property for member text } }
27th Feb 2021, 11:10 AM
Hacı Mehmet Tat
Hacı Mehmet Tat - avatar
0
this is the answer using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Sololearn { class Post { string model; private Post() { model = "New post"; } static void Main(string[] args) { string str; str= Console.ReadLine(); Post Show= new Post(); Console.WriteLine(Show.model); Console.Write("{0}\n", str); } } }
30th Mar 2021, 5:32 AM
ANIKET SINGH
ANIKET SINGH - avatar
0
thanks i can't do any of the final projects on my own. To hard
24th Jul 2021, 3:21 PM
Tom McQueen
Tom McQueen - avatar
0
using System; using System.Collections.Generic; namespace Code_Coach_Challenge { class Program { static void Main(string[] args) { string[] words = { "home", "programming", "victory", "C#", "football", "sport", "book", "learn", "dream", "fun" }; string letter = Console.ReadLine(); int count = 0; //your code goes here for(var i = 0; i < words.Length; i++){ if (words[i].Contains(letter)){ Console.WriteLine(words[i]); count += 1; } } if (count == 0){ Console.WriteLine("No match "); } } } }
10th Sep 2021, 12:09 PM
austine
0
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;} } } }
6th Apr 2022, 10:23 PM
ali010
ali010 - avatar
0
The true is : 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;} } } }
12th Jul 2022, 8:04 AM
soheil ghambari
soheil ghambari - avatar
0
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); Console.WriteLine(Text); } //write a property for member text public string Text{get;set;} } }
6th Sep 2022, 6:19 PM
mahmoud el hefny