Java Programming Question
StArCuE, Feb 20 2011
Okay this is a Comp Sci 1 class and we work mostly with Java. One of the assignments which I am posting below calculated the perimeter and area of a triangle. But now I need to use a dialog box for input and a dialog box for output. So yah I need to use javax.swing.JOptionPane and a string tokenizer. The output needs to be in decimal format as well with one dialog box for the sides of the triangle, perimter, and area. If anyone can guide me through this I would appreciate it. Thanks Chris.
// Interactive Triangle Program
// This program asks the user to input three real numbers
// which are the lengths of the sides of a triangle, and
// calculates the perimeter and area of the triangle and
// prints the results
// Christopher
// Java 1.5, Windows XP
import java.util. * ;
public class InteractiveTriangle
{
static Scanner console = new Scanner (System.in) ;
public static void main (String [] args) throws Exception
{ double num1, num2, num3 ; // input values for sides of the triangle
double sum, s, area;
// Explain the program to the user
System.out.println ("This program finds the sum of the sides of a triangle") ;
// Input the three numbers
System.out.println ("Input your first side.") ;
num1 = console.nextDouble () ;
System.out.println ("Input your second side.") ;
num2 = console.nextDouble () ;
System.out.println ("Input your third side.") ;
num3 = console.nextDouble () ;
// Determine the perimter of triangle
sum = (num1 + num2 + num3) ;
s=sum/2;
// Determine the area of triangle
area = Math.sqrt (s * (s - num1) * (s - num2) * (s - num3)) ;
// Output the results
System.out.print (" The side of the trangle are " + num1) ;
System.out.println (" and " + num2 +" and " + num3 + " nThe perimeter is " + sum) ;
System.out.print (" The area of the triangle is " + area) ;
}
}
School almost over
StArCuE, May 11 2010
Well I saw K40Cheddar blogging about last day of school so I thought I might as well too. However, I have two days left and two psychology finals.
Plans:
-Play more poker
-Play more starcraft
-Play less xbox
-Dorm food does suck but I'm here for another
year so I need to get used to it.
-Stop doing essays 10 hours before they are due
(for summer classes).
-Spend lots of money on the new mountain dew
(theres 3 new flavors and they only pick one).
-and maybe work out because I'm really skinny
(but I hate working out)
-Buy a nice aquarium for my turtle so he can
stay in the dorm with me and we can chill.
(noone chills harder than a turtle).
Lives of Regional Pilots
StArCuE, Feb 23 2010
Pretty interesting topic about regional airlines and pilots that most people probably don't know about. Talks about regional pilot safety, pilot experience, and the faults of flying cheap.
http://www.pbs.org/wgbh/pages/frontline/flyingcheap/view/?utm_campaign=viewpage&utm_medium=grid&utm_source=grid
Didn't even notice but TenBagger recently posted a thread about this. Anyways if you haven't already seen this video, you should watch it.
XBOX Live Sub
StArCuE, Feb 17 2010
Yo I need a 48 hour or 1 month live sub. Will trade ps money. Not sending 1st.
Found one pce.
A Halo 3 wedding
StArCuE, Feb 10 2010
I stumbled across this link on mlgpro.com and saw a video of these two people who got married at the recent MLG Orlando event. Thought it was pretty cool so I'd thought I would post it. Btw when they were walking down the aisle they were playing the Halo 3 theme song from when your in the lobby waiting for a game. Truly a match made in Halo.
http://www.mtv.com/videos/news/335889/i-now-pronounce-you-teammates-for-life.jhtml#id=1603537
PT3
StArCuE, Jan 08 2010
Yo I'm ordering pt3 from lpstore anyone know how they send it? Is it through e-mail or my house?
Anyone wanna play MW2?
StArCuE, Jan 01 2010
Anyone wanna play MW2 search or domination?? Hit me up SiK StArCuE
Cashout Req
StArCuE, Dec 28 2009
Already e-mailed stars but was wondering if anyone knew how much time it takes for money to be sent back to your bank account? Thx Chris.
Computer Science Help
StArCuE, Sep 14 2009
I need help writing a basic machine language program that counts and adds a list of integers. If you can help me understand it I will pay with ps money for your time. Thx Chris. For blog sake, poker is going well.
School and Poker
StArCuE, Aug 17 2009
Man ooo man. School starts today and I have 3 classes from 4 to 8. I'm always excited about school until the day it starts and today it starts. MY first class is English then intro to Chicano studies then Math I think.
I've been playing alot of 50nl and 100nl recently and I've come to the conclusion that 100nl is so so much easier to make money. Probably b/c the games are so much aggresive compared to the 50nl games.
In other news I got this sick Astro A40 Headset. It's sick as fuck.
Anyways I know some of u nerds play halo or cod so drop your ID here and lets play. Pce Chris.
Previous Page Next Page |