Homework Headaches
10 years ago
I am a freaking mess right now. Im under so much stress that Im experiencing a complete breakdown. I just chucked my phone at the wall (which dented the wall, didn't break the phone), and now Im balling my eyes out on the floor trying to write this.
I really don't know how much more of this I can take. Im seriously considering dropping my coding class, because Im fine up until I try doing my coding homework. Then after several hours of failing, I completely lose it. I do all that work, all that intensive studying and reading and thinking, to end up with something that is completely broken
Im scared to drop the class though because it will ruin everything. My major will change, Ill lose a scholarship, everything Ive done for the last 3 years will be completely wasted.
But I cant handle this, I cant take these breakdowns anymore. I had one yesterday and I didn't want to eat anything. Its becoming unhealthy.
Ive never had this problem before, so I don't know how to handle it. I don't know what to expect or do, and I don't know if Ill get worse or things will just click next week and everything will be fine and dandy.
For those who are able to code, you may be able to help me at least get through this week. I gave up on the first problem, and Im just about to give on my second one. Here's my code: http://sta.sh/01dwdstjgslb
Its broken and incomplete. More than likely its horribly wrong.
But I need help. Do I drop? Should I try the tutor? The instructor has been amazingly helpful, its not like I cant get help from him. Something is wrong with me. I cant code. Period. I cant code.
I really don't know how much more of this I can take. Im seriously considering dropping my coding class, because Im fine up until I try doing my coding homework. Then after several hours of failing, I completely lose it. I do all that work, all that intensive studying and reading and thinking, to end up with something that is completely broken
Im scared to drop the class though because it will ruin everything. My major will change, Ill lose a scholarship, everything Ive done for the last 3 years will be completely wasted.
But I cant handle this, I cant take these breakdowns anymore. I had one yesterday and I didn't want to eat anything. Its becoming unhealthy.
Ive never had this problem before, so I don't know how to handle it. I don't know what to expect or do, and I don't know if Ill get worse or things will just click next week and everything will be fine and dandy.
For those who are able to code, you may be able to help me at least get through this week. I gave up on the first problem, and Im just about to give on my second one. Here's my code: http://sta.sh/01dwdstjgslb
Its broken and incomplete. More than likely its horribly wrong.
But I need help. Do I drop? Should I try the tutor? The instructor has been amazingly helpful, its not like I cant get help from him. Something is wrong with me. I cant code. Period. I cant code.
And don't worry, programming can be horribly difficult to get started with, but once you get over the initial hurdle it becomes much easier.
The excercise text says that you have to create classes (Trapazoid, Parallelogram, Rectangle and Square), which inherit from the class Quadrilateral. Before we look at it, let's start with the Point class:
class Point
{
public int x; //assuming 2D points
public int y;
public Point(int x, int y)
{
//not sure how to throw exceptions in your language here...
this.x = x;
this.y = y;
}
}
class Quadrilateral
{
public Point p1, p2, p3, p4; //Using the Point class instead of the int variables
//the following variables are not needed, as the created object will be identified by its class
//public Trapazoid trapazoid;
//public Parallelogram parallelogram;
//public Square square;
//introducing a constructor for Quadrilatetal to assign the coordinates
public Quadrilateral(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
{
//throwing exception here in the child classes
p1 = new Point(x1, y1);
p2 = new Point(x2, y2);
p3 = new Point(x3, y3);
p4 = new Point(x4, y4);
}
//you won't need the getShape() method here as the points are assigned in the constructor
//this method will be specified in the child classes (Square, Parallelogram, etc.)
public int getSize()
{
/*
example for rectangle:
int height = p3.y - p1.y;
int width = p2.y - p1.x;
return height * width;
*/
}
}
For the other classes you only need to inherit from Quadrilateral and overwrite its constructor and getSize() method.
Also If you have Skype or something, I could explain what I did and how it works. I only started working with c++ recently so I'm a beginner too, but I can explain the basics and also what the question is trying to get you to achieve.
Finally, I just found from your DeviantArt account that this is in c# not c++, but this shouldn't matter much as (as far as I know) the basics of the languages are very similar.
My Skype name is Rakceyen. Just mention in the contact request you say BizzareBlue so I know its you.
But seeing how fast you managed to solve the problem is proving my struggles with coding. Ive worked at least 6 hours on this code and only got as far as you saw, aka a broken and horrid program. And in 2 hours you have it solved.
Also ignore the time BizzareBlue, me or someone else, who already knows the basics, needs to program the solution to any problem. Find your own speed.
However I'm curious on which lession number in your coding class this homework was assigned. I'm correcting the homework of the first coding class at my university as a job and inheritance was introduced here about 2 months in. Doing that in the second or third week would really discourage beginners to continue the class in my opinion. This time should be allocated to the basics like if-clauses or loops.