Solved

Space Travel computer java applet

Posted on 1998-07-14
8
217 Views
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
center.
0
Comment
Question by:johnh619
  • 4
  • 4
8 Comments
 
LVL 6

Expert Comment

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

Author Comment

by:johnh619
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.
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
 
LVL 6

Accepted Solution

by:
gadio earned 50 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));
        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
 

Author Comment

by:johnh619
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.
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:johnh619
ID: 1226351
I forgot to put a grade. Sorry!
0
 
LVL 6

Expert Comment

by:gadio
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).
G.
0
 

Author Comment

by:johnh619
ID: 1226353
I did not figure how to give you more points after the question
is closed yet
0
 
LVL 6

Expert Comment

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

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
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…
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.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now