| | |
How do I reset another set of output?
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Dec 2008
Posts: 65
Reputation:
Solved Threads: 1
I've got the codes all done;
so its looks like this:
and the other file is:
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.
so its looks like this:
Python Syntax (Toggle Plain Text)
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:
Python Syntax (Toggle Plain Text)
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.
![]() |
Similar Threads
- Exception in thread "main" java.lang.NoClassDefFoundError: Invaders Error (Java)
- How to configure GD (PHP)
- Programming a Microcontroller (C++)
- Only Perl Returning Incompletre Result Set (Perl)
- trouble using two interrupts at the same time (C)
- wierd gui/constructor problem (Java)
- New to Perl, please explain the script (Perl)
- I've got Trojan.Holax... is this bad? (Viruses, Spyware and other Nasties)
- not-a-virusadware (Viruses, Spyware and other Nasties)
Other Threads in the Python Forum
- Previous Thread: Text File (Part 2)
- Next Thread: Need help in a program
| Thread Tools | Search this Thread |
advanced aliased bash beginner bits calling casino changecolor class clear command convert corners count csv cturtle cursor def definedlines dictionary digital dynamic dynamically events examples external file float format frange function google gui hints homework i/o iframe import info input java line linux list lists loop matching mouse multiple number numbers obexftp output parsing path port prime programming projects py py2exe pygame pygtk python random rational raw_input recursion return scrolledtext signal singleton skinning stderr string strings subprocess table tails terminal text thread threading time tkinter tlapse tuple tutorial ubuntu unicode urllib urllib2 valueerror variable voip web-scrape whileloop windows word wxpython





