javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Hi Friend,

Am offering ready made project in java...it cost of 10000 payment

and am having more project like this if yr friends interested u can make them call to me...

If u needed contact me....

The 10000 is it in US Dollars or in Euros?:)
Because I don't think that any student (school or college) will be willing to pay that kind of money

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Why did you create 2 entirely identically posts?

http://www.daniweb.com/forums/thread162997.html

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

You create a new NOT null ARRAY that holds GameButton elements: grid = new GameButton[1]; grid is an ARRAY.

But:
grid[0] is a BUTTON and you never instantiate it.

So the answer to your problem is quite simple:

Example:

int N=5;
grid = new GameButton[N];

for (int i=0;i<grid.length;i++) { //remember grid is an ARRAY
   grid[i] = new JButton();  //grid[i] is a BUTTON
}
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

First of all:
Next time post what kind of error you get and where you get it so we wouldn't have to search the entire code for the error.

And second:

This:

public static boolean isPalindrome(s) {

}

should be:

public static boolean isPalindrome(String s) {

}
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

First of all I think you need to remove the 'comma'

String[] fileList = { "C:/Users/workspace/emma_chapter1.txt",
"C:/Users/workspace/emma_chapter2.txt",
"C:/Users/workspace/a_christmas_carol_chapter1.txt",
"C:/Users/workspace/a_christmas_carol_chapter4.txt",
"C:/Users/workspace/pride_and_prejudice_chapter3.txt",
"C:/Users/workspace/pride_and_prejudice_chapter42.txt",
"C:/Users/workspace/spirits_in_bondage.txt",
};

Then if how to use a hashmap is your problem then why don't you try looking at the java APIs for the class HashMap. In there you can find all the methods and their explanations

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Check the tutorials at the sun website or buy a book about java.

This thread was created especially for beginners like you. I am surprised you missed it. It is at the top of the java section:

http://www.daniweb.com/forums/thread99132.html

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

In what parameter? Are we supposed to look over your shoulder at what you typed? You create a new Scanner instance for each file in a list (or any other collection). If you're getting errors trying to do that, you need to post your code and the exact error message.

By the way, my code fragment above used the wrong constructor form (it passed the string file name instead of a File object) and has been edited accordingly.

Like Ezzaral said post your code and where you are getting the error. Also remove the throws Exception from the main. What would be the point of the method throwing an exception since no one will catch it. Also you need to add the catch (IOException ioe) { ... } after the try { .. }

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

I didn't read all of your code but I did notice these 2 lines: if (Operator == 'S') Correct because Operator is char if (Operator=="S") It won't behave the way you want it because:

The "S" is a String object. The Operator is a different String object. They might have the same value but they are not the SAME object, so the '==' will never return true.

99% of the cases you will need to do this: if (Operator.equals("S")) The '==' will work only like this:

String a  = "s";
String b = a;
(b==a) //true
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

In your first method you do this: double[][] x=wc; Meaning that changes you perform to one or the other array(object) will be applied to the other because they are the same.
But if you had something like this:

double[][] x = new double[wc.length][];

for (int i=0;i<x.length;i++) {

  x[i] = new double[wc[i].length];

  for (int j=0;j<x[i].length;j++) {
     x[i][j] = wc[i][j];
  }
}

Notice this: x[j] = wc[j]; instead of what you wrote: double[][] x=wc;

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

The IWT2_PO.transform method does not change anything to the first input argument. The first input argument to this function is immediately copied to a new variable. Also, shouldn't the input variable have a different scope anyway?

If it is an object it is passed by reference.
And when you say copy there are many ways to do it, and the behavior depends on the way you "copy".

Also you should post the code of the functions

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Whenever you call this: System.out.print(element); The toString() method of the object is automatically called. These 2 are exactly identical:

System.out.print(element);
System.out.print(element.toString());

If you don't override the toString() method in your class the toString method of the super class is called and in your case the toString method of the Object class

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

You also want to read this:
JTextField

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Link: http://www.netbeans.org

Apparently you want to download something. So click the download button and read carefully the page to find what you want.

As for what is a source code, you think that the developers of NetBeans wrote the IDE using 0s and 1s.

If you have written code and don't know what a source code is then it is either your teacher's fault or yours, because you write it all the time.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

What is your error?
I hope that flipCoin is not null

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

I hope that you realize that this is wrong:

if(input == 0){
        {

        }
        else(input == 1);
  
            }

You should have this:

if (input==0) {

} else {

}

OR:

if (input==0) {

} else if (input==1) {

} else {

}
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

um.. i tried this

BankAccount ba = account[10]
whe i run it, it has this:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 10

When the array has size 10, you can go from 0 to 9:
BankAccount ba = account[9];


whew.. ok i think i get what null pointer means.. hmmmm.. but (gosh). it is in mu:
account.setPin(pin)

BankAccount ba = new BankAccount[10]; //the ARRAY ba is not null

But ba[0], ba[1], .... ARE null.
So I presume that you define the array account but you don't define the account[i] element

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

In your launcher you have to put the toString into a System.out.print or something like that for example:

public class AverageDriver 
{
	public static void main(String[] args) 
	{
		Average object = new Average();
		System.out.println(object.toString());		
	}
}

or

import java.swing.*;
public class AverageDriver 
{
	public static void main(String[] args) 
	{
		Average object = new Average();
		JPaneOption.showMessageDialog(null, object.toString());		
	}
}

You are correct in what you say but I would like to add that you can omit calling the toString method:

public class AverageDriver 
{
	public static void main(String[] args) 
	{
		Average object = new Average();
		System.out.println(object);		
	}
}

The toString method is called automatically.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

org.apache.commons.validator
Class UrlValidator

java.lang.Object
extended by org.apache.commons.validator.UrlValidator

All Implemented Interfaces:
java.io.Serializable

I would suggest importing the package, and also downloading the appropriate jar file

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

haii friends..
i want to search for a file, which resides in my own system using jsp...that is, when i click a button, a search brower is to be displayed which showing all my folders in my system and from that i want to search for the needed file...Is this possibe in jsp???

There is this tag:

<form action="">
     File: <input type="file" />
</form>

Of course you can add more attributes. (name, size).

Here is a tutorial I like to use for html:

http://w3schools.com/html/default.asp

You might want to search in what object to get the file from the request. I don't remember it right now

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

I have NetBeans that makes it very easy to create a GUI. But still there are times where I still write my GUI from scratch.
Opening the text editor and writing the code.

In that way you will learn what is the difference between a JPanel and a JFrame and how to use them.

With NetBeans it may be easy to create good GUI but all you see is some ready code, that I have no idea what it does and I don't understand it.

The GUI that I write it may not be pretty but the coding is simpler. Also there are things that you can't do with NetBeans (at least I don't know how it is done so I just write the code) and if you don't know how to write your own GUI then it would be difficult to implement them.

Also no one told you to do anything. You received plenty suggestions on what IDE to use. I use NetBeans that has a GUI editor if this is what you are looking for, download it and try it.

If you don't like it try something else.
If there is something you can't do or don't understand open a new thread with your question

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Just a few pointers to help you started:

LEAVE the GUI part for last. I mean it. First solve the problem by writing only classes that have the methods you would want to use.

For example write a separate class that read and writes from a file.

Then test them in a main method , then write the GUI and call them.

Also you want a Vector or an ArrayList to save the data while the program runs and the data of the above collection will be saved at the file

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

That is because you haven't defined such a constructor in your Lottery class.

Come on you could have figure that out. Put some effort into it

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

pls i need someone for help , make this program and help me pls !

WHAT program??????

Do you see a program here? I don't see a program here.

Assume that Yes, I would love to make the program for you. Where is the program you want to be done ?????????????

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

can you please explain in your words

I have read the links and they are very explanatory. It says more than I could have posted. Plus it has examples you can look

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Also - should the first line not be 0 1 2 3 4 5?

I pressumed that the answer was Yes

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

ya but i m new Programmer to Java :d
well sir can you please explain Abstract and Interface i m bit confused and unable to understand these both

If you are new don't post wrong answers if you don't understand the question.
Also start a new Thread because what you ask is irrelevant with this post. This one is not solved. How can we possibly post 2 different answers in the same post. Should we ignore the creator of this post to answer your question?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

public class GNumProg{
public static void main(String args[])
{
for(int a=0;a<11;a=a+2)
{
System.out.println(a);}
for(int a=1;a<10;a=a+2)
{
System.out.println(a);}
for(int a=3;a<20;a=a+3)
{
System.out.println(a);}

for(int a=6;a<27;a=a+4)
{
System.out.println(a);}

}
}

..
this is also the simplest way to print series mentioned above ...
there are alot of ways to print but this one is simplest

The original post says:

.. (the pattern presented goes on forever)

How do you accomplish that?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Actually what you wrote umairsario is wrong, and other good programmers will agree with me. Actually I dare to call it stupid. If I was thinking your way I good make a better (and more stupid) program:

System.out.println("0 1 2 3 4 5");
System.out.println("1 3 5 7 9");
System.out.println("3 6 9 12 15 18");
System.out.println("6 10 14 18 22 26");

The idea is to use 2 for-loops and everything would be dynamically, so you could have N lines and M columns.

The pattern to be followed is this:

The difference of the elements of two rows increases by 1
0 (0 + 0) (row = 1 index of for loop is 0)
1 (0 + 1) (row = 2 index of for loop is 1)
3 (1 + 2) (row = 3 index of for loop is 2)
6 (3 + 3) (row = 4 index of for loop is 3)
10 (6 + 4) (row = 5 index of for loop is 4)
15 (10 + 5) (row = 6 index of for loop is 5)

And for the columns each element is added the row num:
First row: 0 1(0+1) 2(1+1) 3(2+1) 4(3+1)
Second row: 1 3(1+2) 5(3+2) 7(5+2) 9(7+2)

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Thanks man, yea that is true but I'm making sure because it is my assignment.

Can't you compile ti and run it?
Also try to add some elements in the ArrayList and then use a for loop to print them.
Do you know how to find the API for the ArrayList?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

You will create separate classes for your employees and they will have the attributes that are described in your assignment (name, hourly paid, ... ). Then the user eneters 'N' you will read the input specified, create a new object 'employee' and add to a list of employees (Use the java.util.Vector or the java.util.ArrayList class)

You will have methods that take as an argument the above Vector with employees and calculate what it is asked.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

His original post had an attached pdf, which I assume was the assignment.

I don't see it at his post. Maybe he removed it, because it says that his first post was edited

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

hey peeps..i got a problem in this project and will be grateful if someone can help pls..thx

We can't help you. No one here has ever done an invisible project. Tell us what is the project and post the code you are having problem with.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

First of all, the javadoc goes outside the method.

Second I believe that you get the error when you run it?
If it is true, then I think the 'hand' Vector doesn't have inside it objects of type Card. What do you put inside the 'hand' ?

/**
         * Gets the card from the specified position in the hand.
         * Null is returned if the position isn't in the hand.
         */
public Card getCard(int position)
    {
        if(position>=0 && position < hand.size())
        return (Card)hand.removeElementAt(position);
        else
        return null;
    }
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

This:

public class Rolling
{   
    private random myDie;
} 
 public static void main(String[] args) {

}

Should be:

public class Rolling
{   
    private random myDie;

    public static void main(String[] args) {

    }
}
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

One way that came to mind is use 2 for-loops

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Try closing the writer: //writer.close(); Why did have that line in comment?
Remove the comment

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Ok I have managed to solve this one too:

I was using this:

<s:iterator value="listOfObjects">
  <s:property="code">
  ................
  <s:radio name="selectedCode" list="listOfObjects"  />
</s:iterator>

The above created a list of radios in each line:

Instead this was needed:

<s:iterator value="listOfObjects">
  <s:property="code">
  ................
  <s:radio name="selectedCode" list="{code}"  />
</s:iterator>

With the above I declare ONE sinlge radio, so as the iterator progresses each line has 1 radio. As for the value of the radio I took this example: http://struts.apache.org/2.x/docs/how-do-i-render-a-single-radio-button.html

peter_budo commented: Nicely done +12
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

I still don't understand why the ATM should extends the BankAccount. You were right to have an array of BankAccounts in the ATM class, so what would be the point of extending.

Also I believe that you need to store the Pin number that you get and use this in order to find the BankAccount you want to manipulate in the getMenu() method

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

I think I have found the solution.
By default the tags in Struts 2 have a theme that renders the tags inside a table.

This can be changed by adding a file:
struts.properties with the line:

struts.ui.theme=css_xhtml

The above changes the way the tags would be rendered. The default is this: xhtml. If you use this: simple the tags would be displayed the way you write them in the code.

With the one I am using it generates <div> tags around the components in order to be easier to add .css style later

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Hi here is another question:
I searched the internet for information about the radio tag, and this is all I found so I put it in my code

<s:radio name="..." list="myArray"  />

The above displays all the elements of the array with radio buttons. My problem is that they are not being aligned when they are displayed.

This is my problem:
I have an iterator and a list with objects:

<s:iterator value="listOfObjects">
  <s:property="property_1">
  <s:property="property_2">
  <s:property="property_3">
   
<code to be added />
</s:iterator>

The above creates a table and each row has the properties of each object in the list. I want each row, to have a radio button at the last column. All the radio buttons will have the Same name and value will be one of the properties of the object in each line. But I cannot use the struts 2 radio tag: <s:radio name="..." list="myArray" /> If I write this:

<s:iterator value="listOfObjects">
  <s:property="code">
  ................
  <s:radio name="selectedCode" list="myArray"  />
</s:iterator>

In each row I will have all the elements of the array.
I now how to do this using for-loop and simple html radio tag. Also I know how to do it with Struts 1 radio button tag. If I remember correctly you can iterate and create in each row a single radio button and take the values from the object your are iterating.

But in Struts 2 the "list" attribute is mandatory in the radio tag. So I cannot create a single radio button …

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Hi, here is the question:
I have 2 textfields in my JSP:

<s:textfield name=" ...." />
<s:textfield name=" ...." />

Now I went to browser and did: View Source Code, and noticed that around the above tags, there were auto-generated tags that put the above fields into 2 rows in a table. It was like:

<tr><td>
<input type="text"  ....>
</td></tr>
<tr><td>
<input type="text"  ....>
</td></tr>

Now I wanted those 2 fields to be at the same row, so I originally wrote:

<table>
<tr>
 <td>  
   <s:textfield name=" ...." />
  </td>
  <td>  
   <s:textfield name=" ...." />
  </td>
 </tr>
</table>

But when I viewed the page at the browser the GUI was messed up and those 2 fields were put one under the other (like in 2 different rows because of the extra generated tr, td tags), But I wanted those fields to be at the same row next to each other (2 different columns).

I am sure that I am doing something wrong, because I have just started learning Struts 2, so is there a way for what I want to be done?
Am I making any sense?

Thanks

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Thanks for the help. I will try and do some more research about what book to buy.
At my work, you might start new project and we decided to implement it in Struts2 and Hybernate
In the meantime I have 2 questions about Struts 2 tags so I will start 2 new Threads

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

you will want something like;

for (int index=0; index <numbers.length; index++){
//Statement printing the number ie. 0, 1, 2 ,3...etc
       for(int index1=0; index<numbers.length; index1++){
//statement printing thestars
   }
//statement toprint new line
}

you cannot put the printstatement comtaining the | and the \n in the inside for loop because it will print it everytime and you only want it before and after the stars respectively.

Beside the fact that the second for loop is wrong, the others (stultuske, Fuze) have tried to help him out by giving him hints on how to solve it on his own.
It would be very easy for them to post the correct code, but nanna wouldn't have learned much that way.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Does you ATM class extends the BankAccount?

If yes then in you ATM class you define only the ATM() constructor, without a super() inside it. Since you don't have a constructor like:
BankAccount() in the super class, you get an error.

Try adding this constructor in the BankAccount:

public BankAccount() {

}

and then:

public ATM(){
                        super();
			start();
		}

OR change the ATM() into this:

public ATM(String name1, int acctNum, int pinNum){
                        super(name1, acctNum, pinNum);
			start();
		}

Of course the above are only correct if ATM extends BankAccount. If not, we will require to see some code.
And also I don't think the ATM should extend the BankAccount. I think that the ATM should have a collection (array, Vector) of BankAccounts

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

You can have a Submit button and when you select the menu, and press the button, you submit to a Servlet, take the value of the drop down box and according to that redirect:

<select name="menu">
<option value="java">Java</option>
</select>

When you submit and do request.getParameter("menu") It will return the "value" attribute of what you have selected.


Now if you don't want a submit button and you simply want when the user selects the menu from the drop down box use javascript:

<select name="menu" onchange="submit_the_form">
<option value="java">Java</option>
</select>

Have the drop down menu inside a form and in the onchange="" write javascript that submits the form

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Thanks, I look into it

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Hi there,
Does anyone know any good books for Struts 2?
I have tried reading: Struts 2 In Action, but I wasn't very thrilled about it

Thanks

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Move the code that reads the input in the while loop

stultuske commented: looks like you've got a lot of patience +3
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

First of all do what stephen84s has suggested, don't put java code and logic in jsp. Only code that displays results.

And you should use ONE big try-catch and put everything inside. The idea with try is that you don't put only the line that has the exception, but also everything that you don't want executed if the exception happens:

If you get an error here: Class c = Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Then none of the following should be executed:

conn = DriverManager.getConnection("jdbc:odbc:namish") ;
        stmt = conn.createStatement();
        result = stmt.executeQuery("SELECT * FROM ARUSER; ");

Also put the above in a separate class that returns the 'data' of the ResultSet

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Try this:

post only the code of the Television class.