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 4 of 4

Thread: Java Programming

  1. #1
    Junior Member
    Join Date
    Sep 2022
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Java Programming

    Write a class that represents triangle named Triangle, the class must have the following members:
    private double height; //Height
    private double base;//Base length
    public Triangle(double h, double b);//Constructor
    public void setHeight(double x);//Sets height
    public double getHeight();//Gets height
    public void setBase(double x);//Sets base length
    public double getBase();//Gets base length


    public double getArea();//Returns the area of ​​the triangle

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Java Programming

    What have you tried?
    Do you have any specific questions about the project?
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Sep 2022
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java Programming

    Like getting an output from the user

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Java Programming

    One way is reading input from the console using the Scanner class. It has several methods for reading different types of data.
    Read the API doc for the Scanner class to see what is available and some examples.
    Link to API doc: https://docs.oracle.com/javase/8/docs/api/index.html
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. NEW JAVA BEGINNER PROGRAMMING TUTORIAL!!!! A PROGRAMMING CHALLENGE!!
    By OrbtialStudios in forum Java Programming Tutorials
    Replies: 0
    Last Post: January 21st, 2018, 08:38 PM
  2. Java Programming (Object Oriented Programming) Assignment
    By azmilPhenom in forum Object Oriented Programming
    Replies: 3
    Last Post: December 21st, 2013, 07:26 AM
  3. Polymorphism Java Programming HELPP P.S. I am a beginner in Java Programming
    By judemartin99 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: April 20th, 2013, 02:21 PM
  4. Linked Lists Java Programming HELPP P.S. I am a beginner in Java Programming
    By judemartin99 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: April 20th, 2013, 02:19 PM
  5. android programming vs game programming using java
    By vgoel38 in forum Android Development
    Replies: 4
    Last Post: September 8th, 2012, 05:48 PM

Tags for this Thread