• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Wheel Project

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was wondering if anyone could help me out on my wheel project. I am kind of new at Java and needed some help. This project is a wheel and has to have 5 spokes. So far I have.....

class Spoke { }

class Wheel
{
Spoke[] spokes = new Spoke[5];
}

any help is accepted. Thanks again.
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well, you have a start. you have a spoke class, and a wheel class. you have an array to hold your spokes. However, you have not yet created any spokes.

declaring an array is like saying "i want a carton that can hold 5 eggs", and you get a carton. There are, however, no eggs in it.

do you know how to create the spokes and put it into the array?
 
Jerrard Maniece
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Naw. Can you help me out with that?
 
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jerrard Maniece:
I was wondering if anyone could help me out on my wheel project. I am kind of new at Java and needed some help. This project is a wheel and has to have 5 spokes. So far I have.....

class Spoke { }

class Wheel
{
Spoke[] spokes = new Spoke[5];
}

any help is accepted. Thanks again.


 
Jerrard Maniece
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
^^Thanks. I added what you pasted, but it's saying "Return Type Method Is Missing". It's saying that at Wheel(). I know wheel is a method, but not sure why that error is coming up.
 
Jerrard Maniece
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
never mind, I figured it out. It's public void Wheel! Thanks
 
Jerrard Maniece
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok. I want to put this in a Applet to show up. At the top I put:

import java.applet.*;

public class Wheel extends Applet

but nothing didn't show up......
 
Manuel Leiria
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jerrard Maniece:
^^Thanks. I added what you pasted, but it's saying "Return Type Method Is Missing". It's saying that at Wheel(). I know wheel is a method, but not sure why that error is coming up.



Wheel is not void, it's the constructor for the class Wheel (the method has the same name as the class).

Anyway I have no idea what you're trying to do and I think neither do you. What exactly are you trying? an applet with a draw of a wheel?
 
Jerrard Maniece
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
^^^, Ya, I just want the drawing of the wheel to show up in the applet.
 
Manuel Leiria
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jerrard Maniece:
^^^, Ya, I just want the drawing of the wheel to show up in the applet.



Int that case you should look at this tutorial:

http://java.sun.com/docs/books/tutorial/deployment/applet/getStarted.html
 
Jerrard Maniece
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, I will check out that and get back with yall, thanks again for the help.
 
Manuel Leiria
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Glad to help!
 
Jerrard Maniece
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got another question. I was wondering do they have a method for a Circle. I see one for Polygon, Arc, Line, Rec, Oval, Round Rect....anything for a Circle?
 
Manuel Leiria
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jerrard Maniece:
I got another question. I was wondering do they have a method for a Circle. I see one for Polygon, Arc, Line, Rec, Oval, Round Rect....anything for a Circle?



A circle is a special kind of oval

 
Jerrard Maniece
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok! Do I just play with the numbers to get it to look like a circle???
 
Manuel Leiria
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jerrard Maniece:
Ok! Do I just play with the numbers to get it to look like a circle???



Sure! An oval has two different radios and a circle as only one radio, so put the same value for the two parameters that defines the radios and you'll get a circle
 
Jerrard Maniece
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So far I got:

import java.applet.Applet;
import java.awt.Graphics;

import javax.swing.JFrame;

public class DrawOval extends Applet
{
public void paint (Graphics g)
{
g.drawOval(10, 50, 200,
getSize() .height - 384);
getSize() .getWidth();

Somewhat correct???
 
reply
    Bookmark Topic Watch Topic
  • New Topic