I need to create a program and this are the instructions please anybody help me


1. Create a program that has a class called demoClass with one method: main.
2. You should create a second class called finalLab.
3. finalLab will have one method, one constructor and one property.
a. The property will be a string called message.
b. The constructor will set message to be equal to the string "Hello World"
c. The method will be called displayMessage and will simply print the string property message to the console.

4. Your main method in DemoClass should instantiate the new object of type finalLab called Final. Call the method displayMessage after instantiating the object. Set message to "I am done with CIS214" and then call displayMessage again.

Output should look like the below
---------
Hello World
I am done with CIS214

this is what i have so far :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class demoClass
{
    public static void Main()
    {
        Console.Write("Hello World");
        finalLab();
    }
    public static void finalLab()
        {
            
        }
    }
}

Edited 6 Years Ago by __avd: Added [code] tags. Encase your code in: [code] and [/code] tags.

You should create a second class called finalLab.

You have made finalLab a method of the demoClass.

finalLab will have one method, one constructor and one property.
The property will be a string called message.

This will involve having a {get; set} after the property is defined

Your main method in DemoClass should instantiate the new object of type finalLab called Final. Call the method displayMessage after instantiating the object. Set message to "I am done with CIS214" and then call displayMessage again.

It's pretty well spelled out for you there. Instantiate (with "new"), call the method (generically) object.method(). Set the string to a new value. call object.method()

I'll leave the rest of it up to you.

Edited 6 Years Ago by jonsca: n/a

mingarrolo.

This is the easiest problem I have come across on these forums. You have literally provided detailed instructions of what you need to do. Because you have incorrectly implemented step two, it leads me to believe you are very very new at coding. Coding is a tough concept to get your head around, so may I suggest you go and spend an hour or so reading a beginners guide to programming. I wouldnt be surprised if most guides start with an example like this. A guid wiil give you a 'overall' understanding of coding. Search for 'programming for begginers' or something like that and you'll find hundreds of sites with similar examples as the one you have provided.

Regards

As the others said, providing a solution at this stage would be doing you a diservice. This exercise is clearly intended to introduce you to the most fundamental concepts in coding. Are you studying at school/college...did your lecturer not explain the terms used in a lecture? I would expect this sort of thing to be set after a lecture teaching you what methods/properties/members etc are, or at least an introduction to the concept of Class/Object.
I wrote a tutorial outlining class/objects earlier for someone that you can check.

Other than that, i can only restate whats been said. You need to read up on the basics and make sure you are familiar with them. If you dont grasp the basic concepts you will find coding very difficult :)

This article has been dead for over six months. Start a new discussion instead.