[java programming] Re: Lab 1034

2009-07-22 Thread Kaka madiba
I believe the problem is with your blocks unless if it was typo, try it this way, the i++ should be within the while block:   int 0;   while (i wrote: From: David Seto Subject: [java programming] Lab 1034 To: javaprogrammingwithpassion@googlegroups.com Date: Wednesday, July 22, 2009, 11:04 AM

[java programming] Re: Error

2009-07-22 Thread african brewer
It would have been easy to help you if you gave the code that is throwing the error. However, i think you are trying to convert a variable into integer that cannot be converted, for example trying to convert "xyz" string to integer. Are you helped? --~--~-~--~~~---~--

[java programming] Re: Error

2009-07-22 Thread miga
On Jul 23, 8:10 am, ben wrote: > hi guys!!! > > i need help in fixing the following errors... > > Exception in thread "main" java.lang.NumberFormatException: For input > string: " " >         at java.lang.NumberFormatException.forInputString > (NumberFormatException.java:48) >         at java.l

[java programming] Error

2009-07-22 Thread ben
hi guys!!! i need help in fixing the following errors... Exception in thread "main" java.lang.NumberFormatException: For input string: " " at java.lang.NumberFormatException.forInputString (NumberFormatException.java:48) at java.lang.Integer.parseInt(Integer.java:449) at

[java programming] XML tool for creating Java GUI

2009-07-22 Thread african brewer
Hi all, I would like to know what tool exists out there that i can use to create my Java Gui and have it stored in XML files. It should allow me to load the XML file at runtime so that the GUI is generated. The reason I want to do this is, am working on aproject which has many components,mostly l

[java programming] Re: comparing strings

2009-07-22 Thread pincer prince
thanks for all the help guys ben --~--~-~--~~~---~--~~ To post to this group, send email to javaprogrammingwithpassion@googlegroups.com To unsubscribe from this group, send email to javaprogrammingwithpassion-unsubscr...@googlegroups.com For more options, visit

[java programming] Re: LAB 1002 - Incompatible types error

2009-07-22 Thread Babu Rajendran
Hi, In your code you have assigned a String to a char variable which is incompatible and hence the error. A char type value should be enclosed in single quote. If you use double quotes, it will be treated as a String. Regards, Babu On Thu, Jul 23, 2009 at 5:30 AM, tinyang wrote: > Hi all. > >

[java programming] Re: Question on 1036

2009-07-22 Thread sudhir Ganesh Paluru
Hello All, I got the program to work.. Thank you all. Most of you were right when you said I had to use firstName[0] always. That was causing the out of bounds issue. Working Code: import javax.swing.JOptionPane; public class ArrayHomeProject { /** * @param args the command line arg

[java programming] Re: comparing strings

2009-07-22 Thread Wayne Barker
Convert the age to an integer and compare just like typical numbers int age1int = Integer.parseInt(age1); int age2int = Integer.parseInt(age2); maxage = (age1int > age2int) ? age1int : age2int; - Original Message - From: "ben" To: "Free Java Programming Online Training Course By Sang

[java programming] Lab1027-6.1

2009-07-22 Thread JKid314159
Dear Rohit Bansal:   Hi Rohit!  This was a very good insight.  That was a really neat trick.  I hope you don't mind if I post to the group.  Thank you. Respects, JKid314159 http://existentialists.blogspot.com/ --- On Wed, 7/22/09, Rohit Bansal wrote: From: Rohit Bansal Subject: Re: [java pr

[java programming] Re: comparing strings

2009-07-22 Thread Maria Vargas
you cannot compare values in string format you have to convert the 'String' type to 'int' type and then compare it with another 'int'  There is a method to convert in the Integer class called parsInt()  for example:  int age = Integer.parsInt(agestr); --- El mié 22-jul-09, ben escribió: De: be

[java programming] Re: Lab 1034

2009-07-22 Thread pacior
You created a scope. incrementation of i variable must be executed in while loop. In order to do this, write this: int i = 0; while (i wrote: > Hello all on lab 1034 homework assignment > > When I run the program and type in the 1st name on the list "Beah" no > problem. > > Name found

[java programming] Re: comparing strings

2009-07-22 Thread pacior
If Your data is age, then You have to compare ints, not Strings.. You do comparision basically in two steps: First is: Cast from String to int Second: compare ints 1* String a = "7"; String b = "8"; int ia = Integer.parseInt(a); int ib = Integer.parseInt(b); if ( ia != ib ) System.out.println(

[java programming] Re: Create java file in windows XP

2009-07-22 Thread pacior
in command line editor ( cmd.exe ) type notepad.exe file.java Other way to open notepad in NetBeans is written here: http://www.javapassion.com/handsonlabs/javalang/index.html#Exercise_4 On Jul 22, 5:52 pm, Zahari Palazov wrote: > Hi, > > Can somebody tells me how can I create empty java file i

[java programming] Re: Find prime number

2009-07-22 Thread pacior
Here is the code that is using command line parameter passing: /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author pacior */ public class MyPrimeNumber { /** * @param args the command line arguments */ public st

[java programming] LAB 1002 - Incompatible types error

2009-07-22 Thread tinyang
Hi all. Here is my code for MyGreatestValueProject2. I'm getting a "Incompatible types" compile error on the following line: min = (zero < num3) ? "The smallest number is less than 10!" : "The smallest number is greater than or equal to 10!"; I think I understand the problem which is declaring

[java programming] Re: comparing strings

2009-07-22 Thread SAMMY REYES
hi ben, 1) You can use equal method for string comparison -ex.  age.equal(ageInputString) 2) In order to get the largest value, first you need to convert it from string to integer (ex.  int ageint = Integer.parseInt(age)) . To get the maximum value, you may need to use math.max() method or con

[java programming] Homework 1011 instruction interpretation?

2009-07-22 Thread Mike Adolf
The homework instructions for 1011 contains the following: Write a static method called generateNewName() as following: * It receives the array of String as a parameter. * It creates a new first name by taking the 2nd character of each String from the array My question is: If

[java programming] Re: comparing strings

2009-07-22 Thread Paul
You must parse of String to Integer value. The Integer class, in java.lang has a static method that does this conversion. Integer.toString, whit a one parameter, a string, or two parameter, String and radix of this number representation by that string. String strnumber = "25"; int n = Integer.par

[java programming] Re: Find prime number

2009-07-22 Thread Paul
Given a integer p > 1, if p can be devided only by 1 and itself, we say that p is a prime number. For example, 31 can only be devided by 1 and 31, so 31 is a prime number; 12 can be devided by six numbers: 1, 2, 3, 4, 6, 12, so 12 is not a prime number. The smallest ten prime number is 2, 3, 5, 7,

[java programming] Re: Lab 1034

2009-07-22 Thread cwleveke
Is there a way to walk through step by step to see what var values are. Specifically a for loop? In command prompt and net beans, is there a lesson on this? Sent on the Sprint® Now Network from my BlackBerry® -Original Message- From: "David Seto" Date: Wed, 22 Jul 2009 11:04:30 To:

[java programming] Re: comparing strings

2009-07-22 Thread Babu Rajendran
Hi Ben, You can use the static method parseInt from the Integer class to convert the String to an integer and then you can compare. For example: String age = "10"; int myAge = Integer.parseInt(age); Regards, Babu On Wed, Jul 22, 2009 at 10:02 PM, ben wrote: > > hi all, > > i want to know how

[java programming] JAR files

2009-07-22 Thread Pablo Derbez
I try to make a JAR file but I'm having problems with the main class. I am using Windows. When I write in the command prompt "jar cfe MyHelloProject2.jar Hello.class MyHelloProject2" the JAR file appears, but i get the following error message: 'Could not find the main class: Hello.class. Program

[java programming] Re: Lab 1034

2009-07-22 Thread Babu Rajendran
Hi David, The increment statement should be part of the while loop. In your program, the block in which you have incremented the value of i will be unreachable. The while loop runs infinitely for any value of name other than the 1st name. So, place the incrementation part inside the while loop an

[java programming] Lab 1034

2009-07-22 Thread David Seto
Hello all on lab 1034 homework assignment When I run the program and type in the 1st name on the list "Beah" no problem. Name found on the list and the program is finished. When I rerun the program and type in the 2nd name on the list "Bianca" the program gets stuck . Here's part of the p

[java programming] comparing strings

2009-07-22 Thread ben
hi all, i want to know how to compare strings... for example if i get the age as a string... how can i compare them and get the largest value to print... thanks ben... --~--~-~--~~~---~--~~ To post to this group, send email to javaprogrammingwithpassion@googlegr

[java programming] Re: Question on 1036

2009-07-22 Thread Tom Anderson
You should use firstName, not firstName[0], since the firstName is selected each time in the loop. On Jul 22, 3:22 pm, Kaka madiba wrote: > You should use firstName[0], since the first name will be at index of 0. Your > error comes up when j =2. --~--~-~--~~~---~--

[java programming] Re: Question on 1036

2009-07-22 Thread Tom Anderson
I think that the error is not the same as the other people have mentioned, since they did not refer to the correct line number. The error message is clear: run: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2 at ArrayHomeProject.main(ArrayHomeProject.java:28) Java

[java programming] Lab 1025

2009-07-22 Thread JKid314159
Re: Polymorphism   Dear Group Manager:   Is this link still up to date.  I am having trouble viewing it.  Says Page Not Found! http://liemur.com/Articles/PolymorphismAndJavaInterfaces.html Respects, JKid314159 http://existentialists.blogspot.com/ --~--~-~--~~~---

[java programming] Lab1027-6.1

2009-07-22 Thread JKid314159
Dear Java Programmer:     INTERFACE WITH METHOD SIGNATURE Package mypersoninterface   public interface PersonInterfaceAnother {      // Add another method to the interface    void reflect();   }//PersonInterfaceAnother interface     CONCRETE CLASS IMPLEMENTATION: Package mypersoninter

[java programming] Re: Getting input form keyboard ----> imports

2009-07-22 Thread Alex Fuentes
Thank you so much! 2009/7/15 Alex Fuentes > Hi all, > A very simple question: > > We can > > import java.io.BufferedReader; > > import java.io.InputStreamReader; > > import java.io.IOException; > > To indicate that we are going to use these three classes > > > > or > > mport java.io.*; > > To in

[java programming] Re: Question on 1036

2009-07-22 Thread erika
2009/7/21 sudhir Ganesh Paluru > Hello All, > > I am trying out 1036 homework and have the following issue > > code : > _ > > import javax.swing.JOptionPane; > public class ArrayHomeProject { > > /** > * @param args the command line arguments > */ > public static void main(S

[java programming] Create java file in windows XP

2009-07-22 Thread Zahari Palazov
Hi, Can somebody tells me how can I create empty java file in windows XP ? --~--~-~--~~~---~--~~ To post to this group, send email to javaprogrammingwithpassion@googlegroups.com To unsubscribe from this group, send email to javaprogrammingwithpassion-unsubscr...@g

[java programming] Find prime number

2009-07-22 Thread nguyen thanh lam
Help me plz ! How to find Prime number ? --~--~-~--~~~---~--~~ To post to this group, send email to javaprogrammingwithpassion@googlegroups.com To unsubscribe from this group, send email to javaprogrammingwithpassion-unsubscr...@googlegroups.com For more options,

[java programming] Re: Lesson 1034 - MyOwnWhileLoop

2009-07-22 Thread Erick Pessoa
Hello David, excuse me, but what should be happening is that the name you are looking for is just the first item in the array names [n] Erick Pessoa 2009/7/21 David Seto > > I did that and my program froze up. > > -Original Message- > From: javaprogrammingwithpassion@googlegroups.com >

[java programming] Re: Question on 1036

2009-07-22 Thread Erick Pessoa
Hello All, It would be necessary to instantiate an object JOptionPane to use it? I think yes ... Erick Pessoa 2009/7/21 sudhir Ganesh Paluru > Hello All, > > I am trying out 1036 homework and have the following issue > > code : > _ > > import javax.swing.JOptionPane; > public class ArrayHo

[java programming] Re: Question on 1036

2009-07-22 Thread Kaka madiba
You should use firstName[0], since the first name will be at index of 0. Your error comes up when j =2.     --- On Tue, 7/21/09, sudhir Ganesh Paluru wrote: From: sudhir Ganesh Paluru Subject: [java programming] Question on 1036 To: javaprogrammingwithpassion@googlegroups.com Date: Tuesday, J

[java programming] Re: Question on 1036

2009-07-22 Thread Rita
Hi Sudhir, The split method returns an array of Strings which is assigned to your array firstname[]. If the name you entered consists of only a first name, the string array returned has the length 1. If you entered first and last name, the length would be 2. Now in the line "if ((j == 0) || ..."

[java programming] Re: ***Request for not sending any mail***

2009-07-22 Thread miga
On Jul 22, 8:31 am, "Moumita Chatterjee" wrote: > Hi All, > Please stop sending me any mail on my official mail id instead of that you > can catch me on this mail id(moumita_chatterje...@yahoo.co.in) There is no way to send you mail on another email address from what you subscribed. So please,

AW: [java programming] Question on 1036

2009-07-22 Thread Oberdieck Dian
Hi, you have created an array that can contain 3 values: String name[] = new String[3]; However your loop run 4 times:   for (int i=0;i<3;i++) When it tries to perform the following code:  name[3] = JOptionPane.showInputDialog("Enter threee names"+3); it comes to an error because the highes

[java programming] ***Request for not sending any mail***

2009-07-22 Thread Moumita Chatterjee
Hi All, Please stop sending me any mail on my official mail id instead of that you can catch me on this mail id(moumita_chatterje...@yahoo.co.in) Thanks & Regards, Moumita Chatterjee UST Global 721,Nila Technopark Campus,Trivandrum. moumita.chatter...@ust-global.com