PDA

View Full Version : Java Help Requested!



GSLeloo
01-10-2004, 08:44 PM
Ok this is for anyone who knows how to program Java... I need some serious help. The marking period ends in two weeks and I just failed a test (bringing my average to a 77). I have not had a C since 8th grade and I really don't want to have one now. There are two things I need....

One is if anyone could help me write these two programs that are due Monday. If anyone is interested just say so and I will type up the lab.

The other part is that I need to know how you put a java applet on a website. Not the html tag but like what exactly you have to load onto your website. Do you have to load objectdraw?

Jonty
01-10-2004, 08:48 PM
I MAY be able to help you. Please post your assignment.

- Me

GSLeloo
01-10-2004, 09:15 PM
Ok here's the first one. Web Ball.

In this project you MUST use four lines, one circle, and one text object. All 6 objects must be visible at all times. Using the canvas clear method is not permitted. Your project must work well with any size canvas. The canvas must appear black with a 5 pixel red border. Your HTML should generate a yellow background.

The radius of the circle should be set by a constant. The position of the circle must be determined by location object whose coordinates start at the center of the canvas. The circle can move in two ways: 1) by going to the location of a cloack, or 2) by following drag locations. The circle is yellow.

Each line extends from one of the canvas corners to the center of the circle. The lines should be contrasting colors of your choice. Use a location object for each of the corners. Use a location object for the center of the circle. When the circle moves, use the setEnd method to relocate the lines. Remember, you must relocate the original 4 lines. You may not create new lines.

GSLeloo
01-10-2004, 09:21 PM
Here is the second one. It's long, called Orange Juice.

Start Up Conditions.
A canvas of size 300 X 150 is on a yellow background and has a black border. Above the canvas in black are the words "Squeeze The Orange" in H1 text. Below the canvas in H4 are the words "Click the canvas to squeeze the orange."

The SqueezePlunger is a red filled rectange exactly 250 X 50 lined up on the left edge of the canvas with 50 pixels above it and 50 pixels below.

The Orange is an orange filled oval exactly 50 X 50 lined up on the right edge of the canvas and with 50 pixels above it and 50 pixels below it.

The plunger and the orange should be tangent.

The Squeeze Distance is set at 10 pixels. Centered in the lower portion of the canvas are the words 'The Squeeze distance is 10."

Clicking
The first click on the canvas causes the plunger to extend 10 pixels (the Squeeze Distance) into the orange but at the same time the orange changes shape by getting 10 pixels thinner and 10 pixels taller (5 above and 5 below)

On each subsequent click the Squeeze Distance is 80% of its former value (and rounded off to the nearest integer) so that each squeeze is slightly less than the squeeze before it.

On each squeeze the color of the orange gets slightly, but noticeably redder.

The Squeeze Distance Label is updated on each click to show the rounded integer.

Exiting
Exiting the Canvas causes the applet to go back to its starting condition.

[Edited on 1-11-2004 by GSLeloo]

Staerin
01-10-2004, 09:29 PM
Hmm, having someone doing your homework for you? Sounds a bit like cheating doesn't it?

GSLeloo
01-10-2004, 09:42 PM
It's not homework. We were given a lab set of 7 problems. He does not expect us to finish and the last lab (Web Ball) will only be 7 points. So technically we won't be losing that much. But technically I just got a 50/100 and I can't afford to lose any more points or I will kill my average.

Staerin
01-10-2004, 09:54 PM
Well, I vote for killing your average. It's less work too, which SHOULD be what you care about. And you know my grades for senior year, and I am in the process of (maybe) turning out fine. Who cares about a dead average! Just as long as you graduate.

GSLeloo
01-10-2004, 09:57 PM
...do you want me to break out in Hives? Yes I should be slacking because I am a senior and already accepted into college... but I CAN'T. It is simply against who I am. If I get a C on that report card I will feel like a failure.

Staerin
01-10-2004, 10:09 PM
You over-achiever!!! Bad Leloo! Quit working so hard, you're more likely to break out in hives from constantly doing work.

Jonty
01-10-2004, 11:53 PM
I'm sorry I can't help with this project here.... My school is dumb and didn't do stuff like that; that's why I left it I didn't work much with creating graphics in applets, so I would have to help in person to be any help.

Why do you have to do this shit in high school?

- Me

Jonty
01-10-2004, 11:55 PM
Heh, I can't stand not getting A's either. I get very pissed off. I've even straight up stopped going to a class because I got a low mark on a test and new I couldn't get the A in that class.

- Me

GSLeloo
01-10-2004, 11:58 PM
I was stupid and took Advanced computer programming... I got an A last semester but I won't this one. Grr!! lol I can't stand a C. I can accept a B (get mad at myself but accept it) but I can not accept a C.

Scott
01-11-2004, 12:16 AM
Originally posted by GSLeloo
I was stupid and took Advanced computer programming... I got an A last semester but I won't this one. Grr!! lol I can't stand a C. I can accept a B (get mad at myself but accept it) but I can not accept a C.

That's depressing......

GSLeloo
01-11-2004, 12:33 AM
What's depressing... that I'm so stupid I get a C?

Scott
01-11-2004, 12:52 AM
Originally posted by GSLeloo
What's depressing... that I'm so stupid I get a C?

No, that it annoy's you to get a C. You try YOUR hardest and you deal with what you get. If you are getting a C because you slacked off, then it's your fault and you need to deal with it. If you can honestly say you tried your best and came up short, why can you not accept it?

It's depressing that you are so upset that you can't get an A in a class you obviously aren't cut out for. You have to learn to accept it. College is going to give you a quick slap in the face if you aren't going to accept grades that aren't perfect. You're going to get a professor that just doesn't hand out those perfect grades. If you work your hardest, you go to the professor and get help, talk to the SI (mostly in college), do your work etc and still can't pass, you should be happy. You can't win them all.....

I like to consider myself fairly smart, I get good grades, however Spanish kills me. I got stuck with it my first semester and I failed, miserably. I took it again, and once again I did bad.... I just don't get Spanish. It doesn't sink in and it's just something I've learned to accept that I can't do it. Don't take a grade you didn't earn, step up and accept what you earned....

HarmNone
01-11-2004, 02:26 AM
Sintik has an excellent point, Leloo. Nobody is good at everything. We have our strong points and our weak points. From the problems you are having in this class, it seems to indicate that this is not one of your strong areas and it was probably a mistake to get into it in the first place.

We make mistakes and learn from them. This is how we find out what we are really made to do. :)

HarmNone

GSLeloo
01-11-2004, 10:30 AM
That's the thing, I took VB programming last year and never dropped below an A. The problem is that this year I am in with a different group of people. We have a class of 20 and I'd say about 12 already know how to program Java. It's like a hobby for them. So the teacher doesn't want to bore them so all he does is give us sections in the book to outline and labs to do in class. I can't teach myself, it's just not how I learn and no matter how hard I try I can't get the concept. I need him to actually teach me like a teacher is supposed to and that's why my grade has dropped from an A first marking period to a C+ now.

HarmNone
01-11-2004, 10:56 AM
Originally posted by GSLeloo
That's the thing, I took VB programming last year and never dropped below an A. The problem is that this year I am in with a different group of people. We have a class of 20 and I'd say about 12 already know how to program Java. It's like a hobby for them. So the teacher doesn't want to bore them so all he does is give us sections in the book to outline and labs to do in class. I can't teach myself, it's just not how I learn and no matter how hard I try I can't get the concept. I need him to actually teach me like a teacher is supposed to and that's why my grade has dropped from an A first marking period to a C+ now.

Have you said this to the teacher, hon? He might not realize why you are having problems. Go to him and explain how you feel. Perhaps he can make some time outside of class to help you catch up. :)

HarmNone

GSLeloo
01-11-2004, 10:57 AM
My friend Debbie and I decided to approach him on Monday. He knows I do well in his class and he should see that there has been a huge change between how I did last year and how I am this year.

Soulpieced
01-11-2004, 11:26 AM
Java is ridiculous, and I can't believe the teacher is giving you that sort of stuff in high school. What you just said was somewhat comparable to my 300 level (junior) final project.

Sean
01-11-2004, 11:26 AM
isn't it sorta like cheating to have someone else write your programs so you can get a better grade?

GSLeloo
01-11-2004, 01:40 PM
I would normally think so but the fact is if he doesn't teach me and I can't do it because I'm not taught how, I will not allow him to fail me. I don't believe it's fair. Besides, I already traded one of the labs with another kid in class so we didn't have to do it again. I guess it's wrong but I'm not one of the 12 that already know Java so he's not really helping me.

GSLeloo
01-11-2004, 02:14 PM
Anyone know what the setEnd method is?

GSLeloo
01-11-2004, 02:19 PM
And in case anyone has any pointers.. this is what I have so far for WebBall

//Christina Norman
import objectdraw.*;
import java.awt.*;

public class Web Ball extends Windowcontroller
{
private Line line1;
private Line line2;
private Line line3;
private Line line4;
private FilledOval circle;
private Text words;
private final int radius=20;
line1.setColor(red);
line2.setColor(blue);
line3.setColor(green);
line4.setColor(yellow);
private Location c1;
private Location c2;
private Location c3;
private Location c4;
c1=new Location(0,0);
c2=new Location(canvas.getWidth,0);
c3=new Location(canvas.getWidth,canvas.getHeight);
c4=new Location(0,canvas.getHeight);
private Location center;
center=new Location(canvas.getWidth()/2,canvas.getHeight()/2);

public void begin()
{
circle.setColor(yellow);
circle=new FilledOval(center,radius,canvas);
line1=new Line(c1,center,canvas);
line2=new Line(c2,center,canvas);
line3=new Line(c3,center,canvas);
line4=new Line(c4,center,canvas);
}

public void onMouseClick(Location point)
{
circle.moveTo(point);
line1.setEnd(
}

public void onMouseDrag(Location point)
{
circle.moveTo(point);
}

}

Artha
01-11-2004, 02:59 PM
Try reading the book your getting this out of?

GSLeloo
01-11-2004, 03:07 PM
We don't have an actual book. We have a website and I can't find it on the website.