Thread: Got a project. No help, confused on how to do this.

  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    2

    Got a project. No help, confused on how to do this.

    I have a project that I have to get done by next Monday, and I am a novice in programming, and am confused on how to do this. Here is the exact project
    Quote Originally Posted by
    For this assignment, you will create an application that contains a collection of rooms. You will be able to move around to and from these rooms by typing in 'north', 'south', 'east', or 'west'.

    In your Program.cs file, you will have an array of Room objects, and you will have an index that represents the current room. You will have a run loop which will collect input from the player. It will then send this input to the Room object in the list refered to by the current room, and it will give you a new room index that represents the room index in that particular direction. You will then set the new room index as the current room index, and print out the current room. You will also have to initialize at least 6 Room objects in the list.

    You also must create a Room class. This room class will have 6 fields. Two strings to represent the room name and description, and then four integers, each the index of the room in a direction. It will have a constructor that takes arguments for all 6 variables, and then copys the values into its own fields. It will also have a method that takes a text input from the player. Based on this input, the method will return the index it has stored for the indicated direction. The Room class will also have an override for the ToString method, so that we can use it to print out the room. All it should do is attach the room name and description together in some form or another, and then return it.
    So far I have been ignoring my Program.cs file and been working on my RoomClass.cs file. I am using Microsoft Visual Studio 2005 Express Edition. So far my entire code is
    Quote Originally Posted by RoomClass.cs
    using System;
    using System.Collections.Generic;
    using System.Text;

    namespace NewProject21
    {
    class RoomClass
    {
    string MainRoom = "You are in the Main Room";
    string MainRoomInfo = "You are in the Main Room. You can go North to the Hallway";

    }
    }
    Last edited by DazedNconfused; 10-08-2008 at 09:23 AM.

  2. #2
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    You are confused, you didn't even put this in the right forum.

    And I'm guessing -- based on your "code" -- that if this is your midterm, someone's not been going to class! Tsk, tsk!

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    You are confused, you didn't even put this in the right forum.
    Right. It looks like C# to my untrained eye, so I will be moving this there.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #4
    Registered User
    Join Date
    Oct 2008
    Posts
    2
    ok, sorry about that, I thought i put it in the right area.

    And It is part of a midterm class... But the teacher is letting us get help from anywhere (but him) as long as we do not copy the code exactly.

  5. #5
    Registered User
    Join Date
    Jun 2003
    Posts
    129
    Ah the joys of trying to explain the answer is in the question...

    "create a Room class. This room class will have 6 fields. Two strings to represent the room name and description, and then four integers, each the index of the room in a direction."

    Break this down:

    Create a class called Room. Give it six fields, two strings and four integers. The names could be gibberish for all anyone cares, well not really, but you get the gist.

    If you don't know this one: "It will have a constructor that takes arguments for all 6 variables" quit the course now, lol.

    Break the question down in to component steps. I have highlighted a couple to kick you butt to get you going. Quite often you have to work backwards to work the whole thing out (I tend to anyway, and others on my degree also found the same thing).

    Go through as many individual items creating them without truly depending on another, then work them together and add the bits in that you can't understand from the code. If you get stuck, take a step back and visualise what the lecturer wants you to achieve: A game where you can move from one room to another.
    He who asks is a fool for five minutes, but he who does not ask remains a fool forever.

    The fool wonders, the wise man asks. - Benjamin Disraeli

    There are no foolish questions and no man becomes a fool until he has stopped asking questions. Charles Steinmetz

  6. #6
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    Your code is barely code. Really you need to work on it and add some application logic before you get some reply code back.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Dynamic Binding
    By gpr1me in forum C++ Programming
    Replies: 1
    Last Post: 03-24-2006, 09:01 AM
  2. How to build a C project?
    By jumpjack in forum C Programming
    Replies: 5
    Last Post: 01-26-2006, 07:35 AM
  3. MFC in an empty project
    By cunnus88 in forum Windows Programming
    Replies: 0
    Last Post: 10-09-2005, 09:19 AM
  4. Game Independent Anti-cheat Project Needs Programmers
    By GIA Project Lea in forum Projects and Job Recruitment
    Replies: 3
    Last Post: 09-15-2005, 07:41 PM
  5. Project Menu Function output
    By Ryan_P in forum C++ Programming
    Replies: 1
    Last Post: 11-06-2002, 04:58 PM