Results 1 to 4 of 4
Thread: Java Question.
- 06-06-2011, 07:56 AM #1
Member
- Join Date
- May 2011
- Posts
- 29
- Rep Power
- 0
Java Question.
Is it possible to have a java program open a picture on the web? If so does it require a lot of coding? This is my program and i would like to have whatever Triangle that is identified show a picture of the Triangle from the web. It isn't necessary but if it doesn't require to much coding I'm for it.
If possible can someone put me on the right track it'll be something completely new to me.Java Code:import java.util.*; public class FinalProjectBeta{ public static void main(String[] args) {int a=1, b, c, p; Scanner in=new Scanner(System.in); while(a!=0) {System.out.println("Enter the length of side \"a\" of the triangle to begin:"); a=in.nextInt(); if(a==0) System.exit(0); System.out.println("Enter the length of side \"b\" of the triangle:"); b=in.nextInt(); System.out.println("Enter the length of side \"c\" of the triangle:"); c=in.nextInt(); getTriType(a,b,c); getAreaPerimeter(a,b,c); } } public static void getTriType(int a, int b, int c) {if(a==0||b==0||c==0||a<0||b<0||c<0) {System.out.println("According to the given sides there was one or more invalid sides of a Triangle."); System.exit(0); } else if(a==b&&a==c&&b==c) {System.out.print("According to the given sides, since a,b and c are equal "); System.out.println("the triangle is an Equilateral Triangle."); } else if(a==b||a==c||b==a||b==c||c==a||c==b) {System.out.print("According to the given sides, since two sides are equal "); System.out.println("the triangle is an Isosceles Triangle."); } else {System.out.print("According to the given sides, since a,b and c are not equal "); System.out.println("the triangle is a Scalene Triangle."); } } public static double getAreaPerimeter(int a, int b, int c) {double s = 0.5 * (a + b + c); double area = Math.sqrt(s*(s-a)*(s-b)*(s-c)); double p = a+b+c; System.out.println("The Area is "+area+" and the Perimeter is "+p+"."); System.out.println(); return area; } }
- 06-06-2011, 08:00 AM #2
What I would do is download the images (providing it is not illegal) and package them up with your code in a jar file.
- 06-06-2011, 08:12 AM #3
Member
- Join Date
- May 2011
- Posts
- 29
- Rep Power
- 0
- 06-06-2011, 08:15 AM #4
Similar Threads
-
Help with Java Question
By joe98 in forum New To JavaReplies: 3Last Post: 03-29-2011, 10:09 AM -
sorry for this question - which is best ? .NET c# or java ?
By funkygarzon in forum Forum LobbyReplies: 33Last Post: 01-21-2011, 03:07 PM -
Need help with java question
By ccie007 in forum New To JavaReplies: 23Last Post: 05-18-2010, 06:32 PM -
Java question
By TGH in forum New To JavaReplies: 12Last Post: 11-27-2009, 02:05 PM -
question about java rmi
By hakimade in forum Advanced JavaReplies: 1Last Post: 07-01-2009, 07:15 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks