Java program
I have a homework assignment due for a class and I have no idea where to begin in the script process can anyone help me? the assignment is this:
When searching for a sailboat to buy, the potential buyers, use several ratios as "rules of thumb" to evaluate a candidate for suitability. The are a bit tired of entering all the data and performing the calculations using a simple hand calculator. The have hired you to write a Java program to perform the calculations when they have entered the necessary data.
The following explainations for formulae may be helpful during the evaluation of a sailboat:
-
Maximum hull speed: Hull Speed = 1.34 * LWL.5
This is the theoretical maximum speed of a displacement sailboat in knots (one that does not plane - a boat which is capable of planing may excape its hull speed).
-
D/L:
Tons may be calculated by dividing displacement in pounds by 2,240. This ratio helps the buyer to place the boat into a light, medium, and heavy displacement category. Boats less than 125 are considered ultra light-displacement, below 200 is a very light-displacement cruiser or a light-displacement racer, below 325 is a moderate-displacement cruiser/racer and anything greater than 325 is a heavy cruiser.
-
SA/D:
This ratio allows the buyer to compare the sail area of different boats with the assumption that the only limitation on boat speed is the displacement of the boat. In reality this is an oversimplification, since a poorly built light boat with gigantic sails might be much slower than a much heavier well constructed boat. However, it does provide a good ballpark estimation and is fairly widely used to indicate boat performance.
The next two ratios are pretty iffy (noone takes much stock in them), but they might yeild a bit more about the boat in question's characteristics.
-
CapI:
The larger the number, the less stable the boat, very wide, light boats will score lower on this index. The modern tendency is for boats to have a wide beam (more room to spread out below), also look at the very wide boats sailed in the Around the World Alone race this past year. Again in reality there is a lot more to the tendency of a boat to capsize (amount of ballast, location of ballast, type of keal, etc). Boat stability is a very complex matter (stability curves are published by US Sailing on most boats afloat in US waters today).
-
ComfI:
Of the various ratios this one is the most tenuous.. In many respects it seems to be the opposite of the CapI with the wider beam increasing the comfort. Oh well, it is just an excersize.
The program you are to write is to provide the input fields for the following input items:
* LOA (total length for the vessel)
* LWL (water line length for the vessel)
* Beam (width for the vessel)
* Displacement
* Sail area
If the input to your program is:
34.5 24.0 10.2 11200 483
Your program will be expected to output the following information:
LOA : 34.50
LWL : 24.00
Beam : 10.20
Displacement : 11200.00
Sail area : 483.00
<a blank line>
Hull speed: 6.56
D/L: 361.69
SA/D: 15.17
Capsize index: 1.86
Comfort index: 28.91
If a calculation cannot be performed (ie: a divide by zero would occur) your program will print the name of the ratio and that it cannot be performed. ie: if Bill entered the following data:
* LOA : 34.50
* LWL : 24.00
* Beam : 10.20
* Displacement : 0.00
* Sail area : 483.00
Your program will need to indicate that:
Hull speed: 6.56
D/L: 0.00
SA/D: Cannot be performed
Capsize index: Cannot be performed
Comfort index: 0.00
if you have even the smallest knowledge of java this is gonna be VERY usefull
http://java.sun.com/j2se/1.4.2/docs/api/overview-summary.html
this will be ur bible for the whole for the time ur learning/coding or doing watever with java
bookmark it.. now!! loll