Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: simple java program display on a window

  1. #1
    Junior Member
    Join Date
    Jun 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default simple java program display on a window

    Hello anyone i'm new here and i'm newbie of java.
    Well i have this very simple java code:

    import java.util.Scanner;


    public class Calculation {

    public static void main(String[] args) {
    Scanner input = new Scanner( System.in );

    double E;
    double sum;
    double sum2;
    System.out.print("type values to a b and c ");
    System.out.println();
    System.out.println( "a= "); // prompt
    double number1 = input.nextDouble();

    System.out.println();
    System.out.println( "b= "); // prompt
    double number2 = input.nextDouble();

    System.out.println();
    System.out.println( "c= "); // prompt
    double number3 = input.nextDouble();


    sum2=number1+number2+number3;
    sum = sum2/2; // add numbers
    E=Math.sqrt(sum*(sum-number1)*(sum-number2)*(sum-number3));
    System.out.println( "T=(a+b+c)/2 = "+sum ); // display sum
    System.out.println("Ε="+"\u221A"+"T*(T-a)*(T-b)*(T-c)="+"\u221A"+sum+"*("+sum+"-"+number1+")*("+sum+"-"+number2+")*("+sum+"-"+number3+")= "+E+" m^2");

    }

    }


    Well i need this to display on a window so if for example click my executable file to open a window


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: simple java program display on a window

    Check out the Swing tutorials.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. [SOLVED] Write a java program to display even numbers between 2 and 200 using netbeans java
    By Shalom in forum What's Wrong With My Code?
    Replies: 0
    Last Post: December 11th, 2012, 05:16 AM
  2. SWING GUI CONSOLE WINDOW DISPLAY
    By Khadafi in forum Java Theory & Questions
    Replies: 5
    Last Post: January 10th, 2012, 09:15 AM
  3. String won't display in my window
    By JamEngulfer221 in forum AWT / Java Swing
    Replies: 6
    Last Post: November 24th, 2011, 04:23 PM
  4. Display Execution Steps - Java Program
    By Max Avion in forum Java Theory & Questions
    Replies: 7
    Last Post: September 14th, 2011, 07:31 PM
  5. Java program to display single and plural words
    By 03EVOAWD in forum What's Wrong With My Code?
    Replies: 1
    Last Post: August 10th, 2009, 11:09 PM