8 Replies - 343 Views - Last Post: 23 October 2019 - 09:29 AM Rate Topic: -----

#1 WarrenBrandt   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 22-October 19

Help with event manager exercise

Posted 22 October 2019 - 03:18 PM

Hi all,

i have an exercise to do, i started by making a script type thing to try work out what needs to be done, but after that I don't really know where to start. I have ideas but cant work out the logistics of the program.

Any help/input would really be appreciated.

heres the exercise requirements:

Event Manager Exercise

An event has a description, the number of people attending, a date and a time. Up to 100 events can
be stored. The following functionality should be available:
Allow a person to enter in details of an event.
Allow a person to print the details of an event (identified by date), or details on all events
with the time and date suitably formatted.
The user should be able to delete an event.
The user should be able to modify an event.

my script:

script
******

welcome user

show menu:
1 create event
2 print event
3 print all events
4 modify event
5 delete event
q to quit

1 create event
user is given questionnaire on the event
user enters event name
user enters the event description
user enters the amount of people attending the event
user enters the date and time of the event
user is then asked if they happy with the event details, if they not it runs the questionnaire again.
else the object event is created.
the program then returns to the main menu


if 2 3 4 or 5 are entered on first round (ie no event has been created yet):
2 print event
3 print all events
4 modify event
5 delete event
user is told there are no events to print


the second time round, the other functionality can be used:
2 print event - asks the user for a date, then finds the matching event
3 print all events - prints all the events in the array
4 modify event - runs the selected event through the questionnaire again
5 delete event - deletes a selected event from the array

the program continues until q is entered in the main menu

when q is pressed from the main menu

the program wishes the user a good day and exits

Is This A Good Question/Topic? 0
  • +

Replies To: Help with event manager exercise

#2 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15363
  • View blog
  • Posts: 61,613
  • Joined: 12-June 08

Re: Help with event manager exercise

Posted 22 October 2019 - 04:19 PM

Do you have a specific question? If you wrote out the steps what have you done since then? Have you tried to create the menu? Have you tried taking in user input?
Was This Post Helpful? 0
  • +
  • -

#3 WarrenBrandt   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 22-October 19

Re: Help with event manager exercise

Posted 23 October 2019 - 06:08 AM

its mostly just planning im having difficulty with, sort of what goes where. This is what I have done so far, its not much but maybe you can guide me in the right direction from here and also see if im missing something.

Im not sure what to do from my menu, do i just call the method for creating an object when 1 is entered?

I have 3 classes:

Office - is just where the main method is
Event - for event data
MenuSystem - for the menus

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

namespace EventManager
{
    class Office
    {
        static void Main(string[] args)
        {
            MenuSystem menu = new MenuSystem();

            menu.WelcomeUser();
            menu.DisplayMainMenu();
            menu.userSelection();
        }
    }
}


Event class

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

namespace EventManager
{
    class Event
    {
        private String eventName;
        private String eventDescription;
        private String numberAttending;
        private String date;
        private String time;
    }
}



MenuSystem class

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

namespace EventManager
{
    class MenuSystem
    {
        public void WelcomeUser()
        {
            Console.WriteLine("\tEvent Manager v1 2019");
            Console.WriteLine("\t*********************");
            Console.WriteLine("\n\tDeveloped by WB software");
        }

        public void DisplayMainMenu()
        {
            Console.WriteLine("\n\tMain Menu");
            Console.WriteLine("\n\t1 create event");
            Console.WriteLine("\t2 print event");
            Console.WriteLine("\t3 print all events");
            Console.WriteLine("\t4 modify event");
            Console.WriteLine("\t5 delete event");
            Console.WriteLine("\tQ to Quit");

        }

        public void userSelection ()
        {
            Boolean userSelected = false;
            Console.WriteLine("\n\tPlease make a selection from the menu:");
            String userChoice = Console.ReadLine().ToUpper();
            while (userChoice != "Q" )
            {
                if (userChoice == "1") Console.WriteLine("1");
                else if (userChoice == "2") Console.WriteLine("2");
                else if (userChoice == "3") Console.WriteLine("3");
                else if (userChoice == "4") Console.WriteLine("4");
                else if (userChoice == "5") Console.WriteLine("5");
                else
                {
                    Console.WriteLine("\tThat is not a valid selection");
                    Console.WriteLine("\tPlease make a selection from the menu:");
                    userChoice = Console.ReadLine().ToUpper();
                }
            }

            userSelected = true;

            Console.ReadKey();
        }
    }
}

Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15363
  • View blog
  • Posts: 61,613
  • Joined: 12-June 08

Re: Help with event manager exercise

Posted 23 October 2019 - 07:14 AM

Do you need a menu class? Typically these homework assignments don't require that.
Was This Post Helpful? 0
  • +
  • -

#5 WarrenBrandt   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 22-October 19

Re: Help with event manager exercise

Posted 23 October 2019 - 07:34 AM

Well this isnt really a homework assignment, im just self studying and wanted to do a proper OOP exercise
I know i could put the menu in my office class, but i thought 3 classes would be fun to try and implement, and i think it makes more sense.
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15363
  • View blog
  • Posts: 61,613
  • Joined: 12-June 08

Re: Help with event manager exercise

Posted 23 October 2019 - 08:06 AM

I would disagree. Seeing where you are going with that code you are already hitting road blocks on getting data out.

It would make sense to have menu in functions and methods near the main, but not particularly in a class. I would advocate trying to make it all work first, with one data class, and then think about abstracting to other classes.

Get the solution down first then jimmy with it. :^:
Was This Post Helpful? 0
  • +
  • -

#7 WarrenBrandt   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 22-October 19

Re: Help with event manager exercise

Posted 23 October 2019 - 08:43 AM

Thanks for your help

I dont want to instantiate the main class, thats why i created a menusystem class
are you saying that the menu could be in static methods in the main class?
Was This Post Helpful? 0
  • +
  • -

#8 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15363
  • View blog
  • Posts: 61,613
  • Joined: 12-June 08

Re: Help with event manager exercise

Posted 23 October 2019 - 08:53 AM

Correct. Nothing beneficial, pertaining to this, is derived from putting the menu in it's own object, but the detractors of readability and code confusion is high.

Ex:
      static string DoMenu()
        {
            string userInput = string.Empty;

            //display menu
            //any validation of input

            return userInput;
        }

        static void MyMain()
        {
            string input = DoMenu();
        }


Was This Post Helpful? 0
  • +
  • -

#9 astonecipher   User is offline

  • Senior Systems Engineer
  • member icon

Reputation: 3001
  • View blog
  • Posts: 11,551
  • Joined: 03-December 12

Re: Help with event manager exercise

Posted 23 October 2019 - 09:29 AM

I'll point out that your Event class, while needed, is pointless at this point. If it is just a model, which is an idea, you should have ways to get and set the properties; currently everything is private so it cannot do anything.

Your userselection is going to end in an infinite loop, think about what it should do and how.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1