Space Travel computer java applet

Posted on 1998-07-14
Medium Priority
Last Modified: 2008-02-26
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
Question by:johnh619
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4

Expert Comment

ID: 1226347
johnh619, is this homework? Is it a joke?   :-)

Author Comment

ID: 1226348
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.
is the url for his java explorer, if you have not seen it.
Sincerely JohnH

Accepted Solution

gadio earned 150 total points
ID: 1226349
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));
        south.add(calculate = new Button("Calulate!"));
        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 ) {
            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.
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Author Comment

ID: 1226350
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.

Author Comment

ID: 1226351
I forgot to put a grade. Sorry!

Expert Comment

ID: 1226352
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).

Author Comment

ID: 1226353
I did not figure how to give you more points after the question
is closed yet

Expert Comment

ID: 1226354
You can issue an empty 'question' stating that its for me, and I'll answer it.

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month14 days, 18 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question