Could not find it? Can you?

When I run this program I can see the message and I can input number but when methods returns d I can not see the value of d at all. I get a message on the applet like this:
Start: applet not initialized
import java.awt.Container;
// Java extension packages
import javax.swing.*;
public class Assignment extends JApplet {
// initialize applet by obtaining user input and creating GUI
public void init()
String s1 = null;
String s2 = null;
String s3 = null;
String FirstNumber;
int option;
// create JTextArea to display results
JTextArea outputArea = new JTextArea();
      JOptionPane.showMessageDialog
         (null,"Enter: '1' to find out HYPOTENUSE \n\n Enter: '2' to find out OPPOSTIE \n\n Enter: '3' to find out ADJACENT ");
// obtain user input
FirstNumber =JOptionPane.showInputDialog("Please Enter your option: ");
option = Integer.parseInt( FirstNumber );
if(option==1) {
s1 = JOptionPane.showInputDialog(
"Please Enter OPPOSITE " );
s2 = JOptionPane.showInputDialog(
"Please Enter ADJECENT " );
else if(option==2)
s2 = JOptionPane.showInputDialog(
"Please Enter ADJECENT " );
s3 = JOptionPane.showInputDialog(
"Please Enter HYPOTENUSE " );
else if(option==3)
s1 = JOptionPane.showInputDialog(
"Please Enter OPPOSITE" );
s3 = JOptionPane.showInputDialog(
"Please Enter HYPOTENUSE" );
else
JOptionPane.showMessageDialog(null,"You have entered wrong code try again please ");
// convert user input to double values
double number1 = Double.parseDouble( s1 );
double number2 = Double.parseDouble( s2 );
double number3 = Double.parseDouble( s3 );
// call method maximum to determine largest value
double pythagoras = maximum(option, number1, number2, number3 );
if(option==1) {
// display numbers and maximum value
outputArea.setText( "HYPOTENUSE is: " + pythagoras);
if(option==2)
outputArea.setText("OPPOSITE is: " + number1);
if(option==2)
outputArea.setText( "ADJACENT is: " + number2);
// get the applet's GUI component display area
Container container = getContentPane();
// attach outputArea to Container c
container.add( outputArea );
} // end method init
public double maximum(int a, double x, double y, double z )
double b,c,d=0;
if(a==1) {
b=x*x;
c=y*y;
z=b+c;
d=Math.sqrt(z);
if(a==2) {
b=z*z;
c= y*y;
x=b-c;
d=Math.sqrt(x);
if(a==3) {
b=z*z;
c=x*x;
y=z-x;
d=Math.sqrt(y);
return d;
}

Thanks for the advice I have fixed the problems but still I am a bit curious how can I not show the third input in each selection ( Please enter 0) but get the third input valid?
kind regards,
import java.awt.Container;
// Java extension packages
import javax.swing.*;
public class Assignment extends JApplet {
// initialize applet by obtaining user input and creating GUI
public void init()
String s1 = null;
String s2 = null;
String s3 = null;
String FirstNumber;
int option;
// create JTextArea to display results
      JOptionPane.showMessageDialog
         (null,"Enter: '1' to find out HYPOTENUSE \n\n Enter: '2' to find out OPPOSITE \n\n Enter: '3' to find out ADJACENT ");
// obtain user input
FirstNumber =JOptionPane.showInputDialog("Please Enter your option: ");
option = Integer.parseInt( FirstNumber );
if(option==1) {
s1 = JOptionPane.showInputDialog(
"Please Enter OPPOSITE " );
s2 = JOptionPane.showInputDialog(
"Please Enter ADJECENT " );
s3 = JOptionPane.showInputDialog(
"Please Enter 0 " );
else if(option==2)
s2 = JOptionPane.showInputDialog(
"Please Enter ADJECENT " );
s3 = JOptionPane.showInputDialog(
"Please Enter HYPOTENUSE " );
s1 = JOptionPane.showInputDialog(
"Please Enter 0 " );
else if(option==3)
s1 = JOptionPane.showInputDialog(
"Please Enter OPPOSITE" );
s3 = JOptionPane.showInputDialog(
"Please Enter HYPOTENUSE" );
s2 = JOptionPane.showInputDialog(
"Please Enter 0 " ); 
else
JOptionPane.showMessageDialog(null,"You have entered wrong code try again please ");
// convert user input to double values
double number1 = Double.parseDouble( s1 );
double number2 = Double.parseDouble( s2 );
double number3 = Double.parseDouble( s3 );
// call method maximum to determine largest value
double pythagoras = maximum(option, number1, number2, number3 );
JTextArea outputArea = new JTextArea();
if(option==1) {
// display numbers and maximum value
outputArea.setText( "HYPOTENUSE is: " + pythagoras);
if(option==2)
outputArea.setText("OPPOSITE is: " + pythagoras);
if(option==3)
outputArea.setText( "ADJACENT is: " + pythagoras);
// get the applet's GUI component display area
Container container = getContentPane();
// attach outputArea to Container c
container.add( outputArea );
} // end method init
public double maximum(int a, double x, double y, double z )
double b,c,d=0;
if(a==1) {
b=x*x;
c=y*y;
z=b+c;
d=Math.sqrt(z);
if(a==2) {
b=z*z;
c= y*y;
x=b-c;
d=Math.sqrt(x);
if(a==3) {
b=z*z;
c=x*x;
y=b-c;
d=Math.sqrt(y);
return d;
}

Similar Messages

  • Hi, How I can duplicate website? I have not any possibility to do it on the right button of mouse. I used to have it, but now I can not find it. can you help me please. Kind regards kate ( email: ukaska@interia.pl)

    Hi, How I can duplicate website? I have not any possibility to do it on the right button of mouse. I used to have it, but now I can not find it. can you help me please. Kind regards kate ( email: [email protected])

    What do you mean with duplicate?
    Where do you want to duplicate a website?
    Do you want to open the same site in more than one tab?<br />
    Do you want to create multiple bookmarks to the site?

  • HT4623 I have an iphone 4s and since it's been fell in the water I can not use the Wi-Fi no more, the maintenance guy could not fixed it, Can you do something?

    I have an iphone 4s and since it's been fell in the water I can not use the Wi-Fi no more, the maintenance guy could not fixed it, Can you do something?

    the maintenance guy could not fixed it,
    If someone other than Apple has attempted to, or opened the iPhone you will have forfeited access to the out of warranty service as described by imobi

  • I have updated my iphone 4s with iOS 6, maps are too poor could not find any location.

    i have updated my iphone 4s with iOS 6, maps are too poor could not find any location.

    You need to update iTunes to 11.1 on your PC

  • Good morning to all of you I have A mac and I did the mistake of upgrading my Lightroom 5.4 to 5.6 Now I can't import anything it says "Could not find namespace: AgCreativeCloudUtils" Could anyone help me resolve this problem?  Should I uninstall the prog

    Good morning to all of you
    I have A mac and I did the mistake of upgrading my Lightroom 5.4 to 5.6 Now I can't import anything it says "Could not find namespace: AgCreativeCloudUtils"
    Could anyone help me resolve this problem?
    Should I uninstall the program and reinstall it
    Thank you so much

    I asked because an awful lot of people have recently been confused between downloading the Cloud and the perpetual versions of Lr - although I'm not automatically assuming your'e guilty of this - and can't understand why their serial no won't unlock their new software.
    If the wrong version has been installed, then it must be uninstalled and the right one downloaded.

  • I am trying to connect my macbook air through my led tv using hdmi but it won't work. I could not find arrangement option on my system preference. how do i make it appear again on my system preference so i can mirror it through my tv. thanks

    I am trying to connect my macbook air through my led tv using hdmi but it won't work. I could not find arrangement option on my system preference. how do i make it appear again on my system preference so i can mirror it through my tv. thanks

    Hi jenette,
    If you are having issues using an HDTV via HDMI as an external display to your MacBook Air, you may find the following article helpful:
    OS X: How to use multiple displays with your Mac in Mountain Lion and earlier
    http://support.apple.com/kb/ht5019
    (Note: You will generally only see the arrangement option in Displays when you are configured to use the external display in Extended Desktop mode; there is no arrangement in Mirroring as both screens are showing the same image.)
    Regards,
    - Brenden

  • I downloaded a song from i-tunes.  It plays on my computer, but won't play on my i-phone.  Any suggestions on how to fix this? Or how can I re-download the song without getting charged a second time.  I could not find an option to "report a problem".

    I downloaded a song from i-tunes.  It plays on my computer, but won't play on my i-phone.  Any suggestions on how to fix this? Or how can I re-download the song without getting charged a second time.  I could not find an option to "report a problem".

    I could not find an option to "report a problem".
    Log in to the Store. Click on "Account" in your Quick Links. When you're in your Account information screen, go down to Purchase History and click "See all".
    Find the item that is not playing properly. If you can't see "Report a Problem" next to the entry, click the "Report a problem" button. Now click the "Report a Problem" link next to the item.
    (Not entirely sure what happens after you click that link, but fingers crossed it should be relatively straightforward.)

  • Can't Find Solution for Could not find Digital Editions folder

    I have checked many posts but I cannot get my ADE to work.  I get the message "Could not find Digital Editions folder."  I am running Windows 7 Enterprise.  I have tried several solutions but the things they are talking about do not exist on my computer (D drive for instance).  Can someone please, please, please help me or either direct me to the proper answer....

    I don't know much about your efforts from your email - such as what you did
    to install ADE and when, and whom you're talking to about your problem (ADE
    or Microsoft).  So, I'll have to wing an answer - and I hope it helps!
    When ADE installs, it sets up an Adobe Digital Editions folder, which
    contains the software and, by default, is installed on Drive C.  If you
    elected to install the software, but did not complete the installation, Win
    7 will show you an icon but won't have the software to back it up.  On your
    desktop, right-click on the ADE icon, and click on Properties at the bottom
    of the drop-down window.  A small window should appear with the location of
    the software.  If it's empty, ADE was not installed properly. It should show
    you a drive and folder.
    So, if it's there, then what's next, you say.  Something is wrong with the
    registry if Win 7 won't open ADE and it shows up in the icon properties.
    ================

  • Can not delete file. Error is "Could not find this item".

    I get the following error when trying to delete a file:  "Item not found".  This is a Word 2007 document that would not save properly so I saved it with a different name.  Now I can't delete the original file.
    The body of the error states "Could not find this item.  This is no longer located in... . Verify the item's location and try again.

    Hi,
    I'm having exact the same problem with a file with a long name, to delete, move, rename, attribute change, etc. I deleted the file, which I receive the confirmation. However, the file is still there, with zero bytes and no extension. When I try
    to delet, move or change the file, I get the error "Could not find this item, This is no longer located in xxx. Verify the item's location and try again."
    I tryed everything: Using DOS, there's no 8.3 name format; In safe mode; chkdsk and sfc. Nothing worked.
    I also tryed the tricks in http://www.sevenforums.com/general-discussion/27924-could-not-find-item-when-deleting-files-3.html
    http://forums.techarena.in/vista-help/1038943.htm
    Without success.
    I took some more time and found this tool on the net "DelinvFile". It works perfectly, after trying EVERYTHING!!!.
    I Have Windows 7 professional 64bits and NTFS.
    Thank you very much.
    Thankyou Thankyou Thankyou Thankyou......... We are almost bald tearing our hair out over this issue and how to fix it.     Delin File WORKS...... At the cost of about 28 bucks well worth it.............. Good onya mate............

  • I can t watch live streamings.The message says:could not find server.Why?

    When i try to see sports from live streaming i can t.Before 5months,i didn t have this problem.But someone send me an error message one day that some application may be harmful for my system and then block it.I can t find anymore this message at firefox.I reset the firefox but didn t work again.I have very good speed at my connection.
    The message when i try to see a football game says:Could not connect to server or could not find the server.What can i do to fix the problem?Please someone,help me!

    From which plugin is this message coming?
    You can try to disable other plugins (e.g. VLC) in case some are interfering.
    *https://support.mozilla.org/kb/Troubleshooting+plugins

  • Why IE5 could not find applet class but Netscape can ?

    Hi,
    I have an applet which is running fine on Netscripts6,
    But not on IE5.
    <APPLET codebase="http://10.1.1.1/demo/" code="ClientApplet.class" HEIGHT=300 WIDTH=300>
    <PARAM NAME="relay" VALUE="1">
    I have all class files under demo directory(the same directory as html file).
    IE5.0 still could not find applet class but Netscript can.

    are you sure its failing to load your classes or is it failing to load a class you are using?
    Remember IE only uses things from 1.1 so simple things like component.getHeight() does not work you have to use size().height
    Its woth enabling the java console and viewing the exact problem.

  • Can´t reinstall maverick, "could not find instalation information for this machine"

    I cant´reinstall Mavericks, a baner say "could not find intalation informacion for this machine"

    Can you select "This solved my question" on your last post. You won't get any points but it will let us know that you no longer have a problem that we need to address.
    Thanks,
    Clinton

  • I got this Could not find installation information for this machine. what i should do now? i can not use my mac, i got this Could not find installation information for this machine. what i should do now? i can not use my mac

    i erased my mac then i tried to download the os x mavericks, wich i had before ; however, i got this Could not find installation information for this machine.

    You should not have erased anything. Maverick uses some of the applications from the older software and now that you have erased part of the Operating System you are going to need the Original Install disc's that came with your machine. Hold down the C key while installing then do all of the Software updates then you can install Maverick.

  • HT4641 Hello there i am using the latest version of pages but when I imported a word do.ument with some figures ( mainly pictures, X-rays,  CT scans, and ECG ) I could not find them they all vanishes although the text was perfectly displayed . Can anybody

    Hello there i am using the latest version of pages on ipad3 but when I imported a word doument with some figures ( mainly pictures, X-rays,  CT scans, and ECG ) I could not find them they all vanishes although the text was perfectly displayed . Can anyone help.
    Thanks

    Thank you very much!
    I cant believe this little comment has been so helpful!
    But yes it is:
    I explain, despite my efforts to find, googled it, forums, faqs, etc...
    no where it mentionned the manifest.fm file is... INSIDE the .jar!
    Your comment "a zip" made me attempt to open it with winrar, and I found a manifest.fm file inside!
    So far I was editing the one at the "source" of my project and rebuilding it with netbeans.
    I am going to try that now.
    Actually.... :( no its mentionning my main class!
    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.7.0
    Created-By: 10.0-b19 (Sun Microsystems Inc.)
    Main-class: courseworkjava3d.Simple3D
    Class-Path:
    X-COMMENT: Main-Class will be added automatically by buildWell I have no problems uploading you the .jar, it is for a coursework it is not a private project or whatever:
    http://www.uploading.com/files/CM2LKWYU/BetaCourseworkJava3d_Final.jar.html
    Oh and I felt on your comment "dont ask us" as if I was suppose to know... i'm a beginner, I did not know that! And I tried to give you so many infos so you dont lose your time if you want to help, especially as after my own research I found many, many results for this "main class" and I tried a few solutions!
    Edited by: CupofTea on Apr 13, 2008 3:28 AM

  • Trying to make a bootable disc but i keep getting this message as a failure notice. "Could not find any scan information. The source image needs to be imagescanned before it can be restored.", what can I do?

    Trying to make a bootable disc but i keep getting this message as a failure notice. "Could not find any scan information. The source image needs to be imagescanned before it can be restored.", what can I do? Any help at all would be appreciated.

    Have you tried scanning the source image? Disk Utility > Images menu > Scan Image for Restore…

  • Can anyone tell me what "Could not find namespace: AgCreativeCloudUtils" means when I hit the Import button?

    Can anyone tell me what "Could not find namespace: AgCreativeCloudUtils" means when I hit the Import button in Lightroom? Thanks

    It means you're hitting a bug.
    Consider filing a bug report here:
    New topic for Photoshop Family
    (along with pertinent information like OS & Lr version, plus conditions which it occurs AND conditions in which it does NOT occur, if you can find any).
    Maybe somebody else with more specific knowledge or experience will be more help.
    Good luck,
    Rob

Maybe you are looking for