I've got the codes all done;
so its looks like this:

public class RightTriangle { 
  
  public static void main(String[] args) { 
    Triangle shape = new Triangle(); 
    
    shape.setBase(4.0);  
    shape.setHeight(5.0); 

    
    System.out.println("The base of the right triangle is " + shape.getBase()); 
    System.out.println("The height of the right triangle is " + shape.getHeight()); 
    System.out.println("The area of the right triangle is " + shape.area()); 
  } 
}

and the other file is:

public class Triangle {  
  private double base; 
  private double height; 
  

  public Triangle() { 
    base = 4.0;           
  } 

  public void setHeight(double newHeight) { 
    height = newHeight; 
  } 
  
  public void setBase(double newBase) { 
    base = newBase;
  }
  
  public double area() { 
    double triangleArea; 
    
    triangleArea = 0.5 * base * height; 
    return(triangleArea);
  } 
  
  
  public double getHeight() {
    return(height); 
  } 
  
  public double getBase() { 
    return(base); 
  } 
}

How/what code(s) do I use to output another set of statements. like right now this program will output:
The base of the right triangle is 4.0
The height of the right triangle is 5.0
The area of the right triangle is 10.0

but then I want it in the same file another output saying:
The NEW base of the right triangle is ...
the NEW height of the right triangle is ...

Like what's that code where I can "reset" the base and heights.

DaniWeb Community > Software Development > Python

So why are you posting java code here?

commented: Yeah, what the hell? +4

oh.. oops...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.