• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Triangle Perimeter HELP!!!

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java is case sensitive and all keywords are lower case.
 
Marshal
Posts: 69495
277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
A magnificient life is loaded with tough challenges. En garde tiny ad:
Try Free Java/.NET Libraries for Word Excel PowerPoint and PDF
htttp://www.e-iceblue.com/free-apis.html
    Bookmark Topic Watch Topic
  • New Topic