This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Triangle Perimeter HELP!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Triangle Perimeter HELP!!!" Watch "Triangle Perimeter HELP!!!" New topic
Author

Triangle Perimeter HELP!!!

Michelle Parker
Greenhorn

Joined: Apr 23, 2008
Posts: 5
Howdie Partners:

I have the following code and get ye olde ';' Exception error.

Please help me!

import javax.swing.JOptionPane;
import java.util.Scanner;
public class Triangle
{
public static void main (String [] args)
{
double num1, num2, num3; // input values
double total, perimeter;
//get side lengths
Scanner rdr = new Scanner(System.in);

// Define perimeter
perimeter = (num1 + num2 + num3);

// Input the two numbers
System.out.println("Input your first number.");
num1 = console.nextDouble();

System.out.println("Input your second number.");
int num2 = console.nextDouble();

System.out.println("Input your third number.");
int num3 = console.nextDouble();

// Determine the total of the first two numbers
int total = (num1 + num2);
int answer = Integer.parseInt(triangle);

If (answer)
(total > num3 = true);
System.out.print("The perimeter is " + perimeter);

Else (answer)
(total < num3 = false);
System.out.print("The data is incorrect.");

// Show output in a dialogue box
JOptionPane.showMessageDialog(null,
output, JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
}
Thank you.

Very humbly yours,
Michelle
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3432
    
  12
Java is case sensitive and all keywords are lower case.


Joanne
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38064
    
  22
Welcome to the Ranch, Michelle. Please give more details of the errors you are getting; I am pretty sure (as Joanne has hinted) that your code as shown won't compile or run so you can get an Exception. If quoting code, please use ctrl-C ctrl-V and don't copy it by hand, in case you introduce yet more errors.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Triangle Perimeter HELP!!!
 
Similar Threads
Problem with Sort Method
Erroneous sym type What does this mean?
Could someone help me out with this?
Fractions
[HOMEWORK] Please need help with java project