• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 236
  • Last Modified:

Space Travel computer java applet

Given two to four stars arranged as neighbors compute the
density of the space precisely midway between them based on
the size and density and temperature of the stars and the
makeup of them and the distance between them. Inputs are all
the data for each star and the ouput is the density of the
hydrogen gas at the point between the stars and also the
strength of the gravity fields from the stars at the midpoint between them. Input for one star could be
the radius of the star, the temperature of the surface and
the core, the density of the star, the makeup of the core
which tells how evolved the star is. Also one additional
variable is the density of the hydrogen gas around the star
which feeds the star, and this densisty is regulated by
the gravity of the star and the star population of the
neighborhood going out about 1,000 light years or more and
all considering the distance of the star from the galaxy
center.
0
johnh619
Asked:
johnh619
  • 4
  • 4
1 Solution
 
gadioCommented:
johnh619, is this homework? Is it a joke?   :-)
0
 
johnh619Author Commented:
No it is not homework or a joke. I want a java applet which I
can input info and then do the math and maybe eventually have
a graphical display. Can you help me? Really I am a novice. I have written one applet so far which I uploaded to my site and
is free. It is a double cache for netscape and IE. It switchs
the names around and leaves the fat file uneffected. I also
have another question in pending for a cache editor. These are
the two applets I am interesting in the most. I have a lot of java books but they just dont seem to answer all the questions.
Any help will be appreciated. I get confused when it comes to
choosing the method and figuring out if there is a method or a
method which I can facilitate; I figure I could learn the logic
and do it with logic if I spent enough time but the method might
be there already which would do it for me. So in my editor applet
I found that there were sort methods but I did not know which to
use and I thought there might be one to separate alpha and then
another for numberic. I just cant find the info. I did however
finally get this guys applet working which displays all the classes and lets you access Sun's site to get more info. He had
to change the memory allocation before it would load properly.
Finally though I did get it working with netscape.
http://www.geocities.com/SiliconValley/Bay/6879/JavaExplorer.html
is the url for his java explorer, if you have not seen it.
Sincerely JohnH
0
 
gadioCommented:
Ok, heres a sample of (through what I undestand) your GUI can be. You need only to put the actual calculation into the last function. If you need more info - ask.

1. File stars.java


import java.applet.Applet;
import java.awt.*;

public class stars extends Applet {

    TextField fields[][];
    Checkbox stars[];
    TextField result;
    Button calculate;

    /**
     * Initializes the applet.  You never need to call this directly; it is
     * called automatically by the system once the applet is created.
     */
    public void init() {
        fields = new TextField[4][6];
        stars = new Checkbox[4];

        setLayout( new BorderLayout());
        Panel mid = new Panel();
        mid.setLayout( new GridLayout( 5, 7 ));
        mid.add(new Label(""));
        mid.add(new Label("radius of star"));
        mid.add(new Label("surface temp."));
        mid.add(new Label("core temp."));
        mid.add(new Label("density"));
        mid.add(new Label("core makeup"));
        mid.add(new Label("hydrogen dens."));
        for( int star = 0; star < 4; star++ ) {
            mid.add( stars[star] = new Checkbox("Star "+(star+1),false) );
            for( int param = 0; param < 6; param++ ) {
                mid.add( fields[star][param] = new TextField(10) );
            }
        }
        Panel south = new Panel();
        Panel south_right = new Panel();
        south.setLayout(new GridLayout(1,2));
        south_right.add(new Label("result:"));
        south_right.add(result = new TextField(10));
        result.setEditable(false);
        south.add(calculate = new Button("Calulate!"));
        south.add(south_right);
        add("North", new Label("Star calculations"));
        add("Center", mid);
        add("South", south);
    }

    /**
     * Called to start the applet.  You never need to call this directly; it
     * is called when the applet's document is visited.
     */
    public void start() {
    }

    /**
     * Called to stop the applet.  This is called when the applet's document is
     * no longer on the screen.  It is guaranteed to be called before destroy()
     * is called.  You never need to call this method directly
     */
    public void stop() {
    }

    /**
     * Cleans up whatever resources are being held.  If the applet is active
     * it is stopped.
     */
    public void destroy() {
    }

    public boolean handleEvent( Event e ) {
        if( e.target == calculate ) {
            doCalculations();
            return true;
        }
        return false;
    }

    //----------

    private void doCalculations() {
        // Check which of the stars checkboxes is on and calculate accurdingly.
        // Put the result in the result textfield.
        result.setText("res"); // change this line.
    }
}

---------
Hope that helps you build your applet.
G.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
johnh619Author Commented:
Thank you gadio, if feel this is worth more than 50 points please
tell me, since I figure it does seem more to me than you. I only
have 85 points at present though. Please visit my website if
you wish: the subject space travel.
http://users.aol.com/johnH67212/index.htm is the main page.
I just finished compressing the graphics using the gif wizard
and it loads about twice as fast.
Really the subject of the applet is deeper than it seems on a
first glance level. The ramification of it is related to time
dilation. I wish to try to prove that though an astronaut may
only experience a few seconds of time distortion when they visit
the moon or mars, he may find extreme time dilation or contraction if he visit deep interstellar space. Therefore space
is only as euclidean as the space around one star. If you take
a group of stars then each creates its own euclidean space which
is not running at the same rate as its neighbor.
0
 
johnh619Author Commented:
I forgot to put a grade. Sorry!
0
 
gadioCommented:
johnh619, first I'd like to say that yes, I also feel that it worth a bit more but you problem is interesting so... :-)   Anyway, if you have any more Qs, or if youd like to add any graphic  representation of the problem later, you can address me with specific questions (I did a lot of graphics and animation in any languge).
Secondly, this is very interesting. I do know that the space is not euclidean, and I thought that it had to do with the effect of gravity fields of the stars (and singular points in black holes). Is this the base of your thesis or is it another idea? Are you doing this only as a theoretical expirimet or do you prove this through experimentation? How do you isolate deep space enviroment? I'm sorry if my Qs are simple and abstract. As an engeneer I took several courses in physics, but it is relatively only basic physics (I didn't get very deep on the theory of relativity).
G.
0
 
johnh619Author Commented:
I did not figure how to give you more points after the question
is closed yet
0
 
gadioCommented:
You can issue an empty 'question' stating that its for me, and I'll answer it.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now