Requesting Tutor!!

Hey guys, I know a lot of you are pretty good at answering questions and actually giving help to those of us who need help with certain stuff. I recently posted something I needed help with but haven't been able to get any responses on time to help me with my homework.

What I am asking for is someone who could give me some tips on my homework and someone I can contact during reasonable hours during the day (meaning I won't expect to be able to contact you at 3 a.m.) Would help if I could add you on skype and message when I need help on my homework for school.

I won't be able to pay you but I appreciate anyone willing to help out the noobs!
there is a Jobs section in the forums full with "noobs!", the only way you can get attention is if some of you gather into a group and help each other.
Yeah well the reason I didn't post in the Jobs section because a job usually entails getting paid which I cannot offer any money since I'm a college student. I guess I can give that a try but I didn't want to give anyone the wrong impression and I'd kinda like someone with experience because when I ask other people with my skill level they usually don't know how to do what I'm asking about ya know? I'd like someone to help me who knows what they're talking about.
I'm a college student too (second year), its not that I dont need help, its just that I found out that whenver I ask someone with "experience" for advice they usually just google it and tell me what they see, then i thought, well I can do that myself, no? thats how I got to this site btw. In the end, and every programmer will tell you this, you need to teach yourself. Do small tests, read lot of documentation, programm step by step, aquire your own way of coding.

then find people like yourself and learn to work together, thats what advanced really means. being able to programm readable modular code that others can use and add their own too it.
Yeah well problem is I don't have time to be looking it up constantly. I have two classes going on at the same time that I need to be looking stuff up for, I look up stuff for my homework all week and get maybe halfway through my assignment.

I'd love to work on stuff with someone but since they would need help I wouldn't be able to give them any help. Not to sound selfish but I don't have time to help someone else. When I have time and the skill to help other people, I will, but right now I can't.
I heard that one before Bradley, as a matter of fact I hear that excuse every day. Dont ever ever, ever! complain about time unless you are spending every minute and every moment accually using it. your lazy just like the rest of us human beings.

nvm that, ill tutor you, whats your assignment?
Well as a college student I'm constantly doing homework, at work, or sleeping. Have no free time for doing something for myself so yes I have no time.

Right now we are working on hash tables and queues. This is what my homework says:
Park visitors will register at a kiosk if they want to ride the new theme park ride.
Visitors will give their full names.
The Horacious Glump system will hash their names to a particular ride number.
Visitors will then be placed in the queue for the ride number.
At each time interval all rides will run simultaneously.
At the end of the ride the first person in each ride queue will be removed.
There will be seven rides in the system for the prototype
Each ride queue holds a maximum of three people for testing.


If you could IM me on skype that would be better. This is actually due by noon tomorrow so I don't know how much I can get done by then but I will be getting a new assignment in class tomorrow.
well this exercize sucks, its not what hash tables are used for anyways. basically you need to make 7 Queues, you can try to implement it yourself, or if you dont got time, use a labrary one. Make a class Visitor, and have each visitor assigned to a queue. thats about it. There has to be more to this assignment then what you gave here, because many specifications are missing
Oh yeah I only gave you a tiny bit, like the summary pretty much.

Basically what we have to do is it is like a kiosk for a ride in the future (I guess to help get rid of lines?) that is supposed to prompt for the visitor's name, add them into one of the 7 queues for one of the seats on the ride. Think of it as a rollercoaster that has 7 cars, and each car only seats one person. When the ride runs, the first person in each queue will be dequeued and there will be space open for a new person to register.

So the when the visitor adds their name in it will hash their name into the queue, then inserts the person into the queue, and prints a confirmation for them.

What I need help with is making the hash table. It needs to be size 7 for the 7 cars. I don't even know how to begin.
Here is all my code so far...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
//Queue.h
#ifndef QUEUE_H_
#define QUEUE_H_

void menu();
void Exit();

typedef string ItemType;

/*************** Queue ***************/

class FullQueue
{};
class EmptyQueue
{};


class Queue
{
public:
	Queue(int max);
	Queue();
	~Queue();
	void MakeEmpty();
	bool IsEmpty() const;
	bool IsFull() const; 
	void Enqueue(ItemType newItem);
	void Dequeue(ItemType& item);
	void PrintQueue();
	int LineWait();
private:
	int front;
	int rear;
	ItemType* item;
	int maxQueue;

};

/*************** Constructor ***************/
Queue::Queue()
{
	maxQueue = 3;
	front = maxQueue - 1;
	rear = maxQueue - 1;
	item = new ItemType[maxQueue];
};

/*************** Destructor ***************/
Queue::~Queue()
{
	delete [] item;
};


/*************** Functions ***************/
void Queue::MakeEmpty()
{
	front = maxQueue - 1;
	rear = maxQueue - 1;
};

bool Queue::IsEmpty() const
{
	return (front == rear);
};

bool Queue::IsFull() const
{
	return ((rear+1) % maxQueue == front);
};

void Queue::Enqueue(ItemType newItem)
{
	if (IsFull())
		throw FullQueue();
	else
	{
		rear = (rear + 1) % maxQueue;
		item[rear] = newItem;
	}
};

void Queue::Dequeue(ItemType& item)
{
	if(IsEmpty())
		throw EmptyQueue();
	else
	{
		front = (front + 1) % maxQueue;
		item = item[front];
	}
};

void Exit()
{
	cout<<"Exiting Program...\n";
	cout<<"Have a nice day!\n";

	return;
}

#endif 


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//MenuFunctions.h
#ifndef MENUFUNCTIONS_H_
#define MENUFUNCTIONS_H_


/*************** Hash Table ***************/

//I don't think any of this is right....

void hashTable(int &index, char *num);

const int HTsize = 7; //hash table size is 7

void hashTable(int &index, char *num)
{
	char *hashArray[HTsize]; //same as hashArray[][]
	bool found = false;

	for(int i = 0; i < HTsize; i++)
	{ //search for duplicate

		if(strcmp(num,hashArray[i]) == i) //check for same num
			found = true;
		if (found) //duplicate found
			index = (index +1) %HTsize;

		strcpy(hashArray[index],num); //locate num in hash with an index
	}

}

/*************** Add Person ***************/
void AddPerson();

void AddPerson()
{
	string FirstName,LastName,FullName;
	cout<<"Please enter your first name: ";
	cin>>FirstName;
	cout<<"\n";
	cout<<"Please enter your last name: ";
	cin>>LastName;
	FullName = FirstName+" "+LastName;
	cout<<"\nThank You "<<FullName<<endl;

	Enqueue(FullName);



#endif 


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//main.cpp
#include <iostream>
#include <string>
#include <string.h>
#include "Queue.h"
#include "MenuFunctions.h"

using namespace std;

int HashName(string);


void main()
{
	menu();

	return;
}

void menu()
{
	int choice;
	cout<<"\t-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-"<<endl;
	cout<<"\t /Horacious Glump Ride Interface Menu /"<<endl;
	cout<<"\t-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-"<<endl;
	cout<<"\t|	1 - Add rider to line	"<<endl;
	cout<<"\t|	2 - Run the ride	"<<endl;
	cout<<"\t|	3 - Find wait time	"<<endl;
	cout<<"\t|	4 - Display the line	"<<endl;
	cout<<"\t|	0 - Exit program	"<<endl;
	cout<<"\t-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-"<<endl;
	cout<<"Please enter your selection: ";
	cin>>choice;

	switch(choice)
	{
		case 1:
			// Add Rider Function
			break;
		case 2:
			// Run the ride function
			break;
		case 3:
			// Find wait time function
			break;
		case 4:
			//Display the line function
			break;
		case 0:
			Exit();
			break;
		default:
			cout<<"** INPUT INVALID, PLEASE TRY AGAIN **"<<endl;
	};


	return;
}


int HashName(string)
{
	int hashValue = 0;
	int hashSize;
	string testString;

	for (unsigned int index = 0; index < testString.length(); index++)
	{
		hashValue = (hashValue * 31) + testString[index];
		hashValue %= hashSize;
	}
	
	return hashValue;
}
//I don't think any of this is right....

you got that right.


first things first. you need to make a Queue and Visitor class.

a Visitor class needs only a string variable, but I would add a static id that would increment by one each time, maybe you didnt learn static yet but whatever, cannt hurt.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
class Visitor{
public:
    char * name;
    Visitor(char * _name);
    ~Visitor();
    int myId;
    static int id;
};

int Visitor::id = 0;

Visitor::Visitor(char * _name){
    int size = 1;
    for(int i=0; i<30; ++i){
        if(_name[i] == '\0')
            break;
        ++size;
    }
    name = new char[size];
    for(int i=0; i<size; ++i)
        name[i] = _name[i];

    myId = id++;
}

Visitor::~Visitor(){
    delete [] name;
}


then you want to make a Queue from these visitors, for that you need a Node class

1
2
3
4
5
6
class Node{
public:
   Visitor * v;
   Node * next;
   Node(Visitor * _v, Node * _next): v(_v), next(_next){}
}


now all you need is a Queue class that will implement the chain of these Nodes and put 7 of these queues in a class called a hash table, thats the fun part so ill leave it to you.
Alright thank you. Most of this makes sense and I should be able to figure out what most of it means if I don't already know. I have already learned static so you don't have to worry about me not knowing what that means but thanks.

I really appreciate the time you put into doing this much for me and I know it is late (not sure where you live but I'm sure its late there unless you don't live in America). You helped out a lot.
nope im from Israel, its morning lol. whatever, I made the id so that each visitor will be assigned a different one whenever you contruct a visitor. A hash requires a field that is different for each visitor, because the hash function which is simply id%7 needs to distribute the visitors equally across its 7 queues.
Oh yeah something told me you'd be from another country since you were helping me out. It was around 2 or 3 in the morning when I was working on this last night so that's why I had to stop for the night. I couldn't finish it in time because I really had to sleep but you helped me get that much closer. Thanks.
Topic archived. No new replies allowed.