Search Results

Showing results 1 to 40 of 53
Search took 0.06 seconds.
Search: Posts Made By: firstPerson ; Forum: Java and child forums
Forum: Java 6 Days Ago
Replies: 5
Solved: for loop??
Views: 208
Posted By firstPerson
whats the problem?
Forum: Java 21 Days Ago
Replies: 31
Views: 1,097
Posted By firstPerson
>>Is this what is required to create an object in Java?
Yes, you have to instantiate every object in java.

>>What do they mean when they say handPhone type?
Its a data type just like a int is a...
Forum: Java 21 Days Ago
Replies: 2
Views: 406
Posted By firstPerson
Yea I know that method, but its hard to use the debugger. I
realized that java was discontinued with visual after 05. Thanks
for the input though.
Forum: Java 22 Days Ago
Replies: 2
Views: 406
Posted By firstPerson
I use netbeans but was wondering if anyone knew how to add a Java compiler to visual studio 2008?
Forum: Java 23 Days Ago
Replies: 2
Views: 398
Posted By firstPerson
Google Arrays.sort.

Just get the user input into an array, and use Arrays.sort( anArray),
then the anArray is sorted.
Forum: Java 23 Days Ago
Replies: 2
Views: 296
Posted By firstPerson
Use the mode (%) operator inside a for loop like so :


final int MAX = 100;
for(int i = 1; i < MAX; ++i){
if(i % 2 == 0 ) /* if i is a multiple of 2 */
{ //do stuff }
else if(i % 3...
Forum: Java 26 Days Ago
Replies: 4
Views: 386
Posted By firstPerson
First by Googling it! (http://leepoint.net/notes-java/data/arrays/70sorting.html)
Forum: Java 27 Days Ago
Replies: 5
Views: 342
Posted By firstPerson
Use the ? : operator.
Forum: Java 31 Days Ago
Replies: 4
Views: 386
Posted By firstPerson
>>note the question ask to reprint the array but without any repeating number

You can use the library sort method and then display the first element.
Compare it with its adjacent, if different...
Forum: Java 31 Days Ago
Replies: 1
Views: 297
Posted By firstPerson
It is converting it correctly. It just doesn't display the trailing 0's.

If you want to see the trailing 0's then you can use DecimalFormat...
Forum: Java Nov 12th, 2009
Replies: 2
Views: 207
Posted By firstPerson
Recursion is a bad idea here. But if this is what you want :

String str = "vertical";
printVertical(str);


and if the output should be :

v
e
Forum: Java Nov 10th, 2009
Replies: 5
Views: 513
Posted By firstPerson
make initCheck a static method. Do you know what the term static mean
in the context of programming?
Forum: Java Nov 8th, 2009
Replies: 7
Views: 301
Posted By firstPerson
>>or some reason it doesn't think accountSum has been initialized so my program won't run
<<

Yea its right, sorry I am in c++ mode.

try :

Account accountSum = new Account();
Forum: Java Nov 8th, 2009
Replies: 7
Views: 301
Posted By firstPerson
>>
Add a static method Account consolidate(Account acct1, Account acct2) to your Account class that creates a new account whose balance is the sum of the balances in acct1 and acct2 and closes acct1...
Forum: Java Nov 7th, 2009
Replies: 7
Views: 304
Posted By firstPerson
Yea, sometimes, but IMO not all the times. It depends on the variable
name. When giving a variable name, if giving it isBlah doesn't
necessarily make sense, for example, suppose you have a state...
Forum: Java Nov 3rd, 2009
Replies: 11
Views: 468
Posted By firstPerson
>>last 15 years
Wow, I have just programming for about 2 yrs on/off so you have a lot more knowledge than me. Nevertheless I would still like to debate even though if I may be wrong, if that's OK...
Forum: Java Nov 3rd, 2009
Replies: 11
Views: 468
Posted By firstPerson
>>
"what guarantee do you have that you are actually comparing values in c++?"
<<

In c++ the "!=" operator when used with container from std does not compare address like the "==" in java ( at...
Forum: Java Nov 3rd, 2009
Replies: 11
Views: 468
Posted By firstPerson
late reply but its just preference at times.

A thing to note ( at least in c++) is that != is more generic than
'<' because '!=' works with containers like vectors, string map
while '<' is not...
Forum: Java Oct 28th, 2009
Replies: 2
Views: 266
Posted By firstPerson
>> However, when rotating a cube, my cube slowly shrinks. Is this s result of loss of accuracy in Math.sin() and Math.cos()? Or is it possibly because I'm casting these values to float, since I use...
Forum: Java Oct 28th, 2009
Replies: 3
Views: 226
Posted By firstPerson
>>Hi there,
Hello there.

>>I am new in java and some basic help would be appreciated. e.g
Ok lets see...

>>1-What's the out put of;
>>double number = (1/3)*3;
>>System.out.println("(1/3)*3...
Forum: Java Oct 25th, 2009
Replies: 2
Views: 207
Posted By firstPerson
Did you try it out?
Forum: Java Oct 25th, 2009
Replies: 1
Views: 389
Posted By firstPerson
Hint :

totals[die1 + die2]++;

should be :

totals[roll] = die1 + die2;

and make sure totals can hold up to 1000 dice roll information.
Forum: Java Oct 16th, 2009
Replies: 9
Views: 475
Posted By firstPerson
try posting your whole code
Forum: Java Oct 16th, 2009
Replies: 2
Views: 190
Posted By firstPerson
I think you want it to be this :

static float calcTaxes(float grossPay)
{
float netPay ;

if (grossPay <= 300)
netPay = (float) (grossPay - (grossPay * 0.15));

if (grossPay <= 450)
Forum: Java Oct 13th, 2009
Replies: 3
Views: 217
Posted By firstPerson
String msg = "place message here";
int cntr = 0;
for i = 0 to msg.size; increment i by 1
{
if msg.charAt(i) is equal to a white space or == ' ' then
increment cntr by 1;
}
...
Forum: Java Oct 6th, 2009
Replies: 11
Views: 468
Posted By firstPerson
1) Create a array, which represents a table.
2) use a for loop;


for(int i = 1; i != 5; i++)
myArrayTable[i] = 6*i; //say, myArrayTable is already declared.
Forum: Java Oct 4th, 2009
Replies: 13
Views: 574
Posted By firstPerson
Make use of functions. Try something like this


import java.util.Random;

class Main
{
static Random rand = new Random();

static void Print(Object ob){
Forum: Java Oct 4th, 2009
Replies: 13
Views: 574
Posted By firstPerson
It would help if you created a few function that returns either
lowercase, uppercase , number or a punctuations.

The in your randomLowercase(int len) function you can something like
for(int i =...
Forum: Java Oct 4th, 2009
Replies: 11
Views: 421
Posted By firstPerson
You could sort it and then check if the next element is the same and
work from there.
Forum: Java Oct 3rd, 2009
Replies: 11
Views: 421
Posted By firstPerson
It works for me :

import java.*;


class Main
{
static void Print(Object ob){
System.out.print(ob);
}
Forum: Java Oct 3rd, 2009
Replies: 11
Views: 421
Posted By firstPerson
Why is that again?
Forum: Java Oct 3rd, 2009
Replies: 11
Views: 421
Posted By firstPerson
Yes. In fact thats very common, using 1d array as a mimic of a 2d.


final int ROW = 5;
final int COL = 5

char[] Letters = new char[ ROW * COL];

for(int i = 0; i < ROW * COL; i++)
...
Forum: Java Oct 2nd, 2009
Replies: 8
Views: 396
Posted By firstPerson
Uhh, Nope. Where would you get that idea? Recursive functions are expensive. It should be only used when it simplifies a lot of complexity,
and has reasonable performance.
Forum: Java Oct 2nd, 2009
Replies: 4
Views: 419
Posted By firstPerson
for(int i = 1; i <= 10; i++)
{
for(int j = 1; i <= i; j++)
System.print(j);

System.println();

}
Forum: Java Oct 2nd, 2009
Replies: 8
Views: 396
Posted By firstPerson
I'm sorry my mistake, it should have been int getFact(int N);

Max is just any number. I just put it there so, as an arbitrary value.
Its not meant to be a full code, just enough to give you a...
Forum: Java Oct 1st, 2009
Replies: 8
Views: 396
Posted By firstPerson
create function;

void getFact(long N); //assume already created

for(int i = 0; i < MAX; i++)
Array[i] = getFact(i);
Forum: Java Sep 29th, 2009
Replies: 1
Views: 133
Posted By firstPerson
To share your problem, just post the problem. Ask specific question.
Maybe google it before you ask question, in which you might find the
answer.
Forum: Java Sep 26th, 2009
Replies: 7
Views: 346
Posted By firstPerson
total = distance / mpg * ppg + parking + tolls;

or

total = distance / ( mpg * ppg + parking + tolls ); ???
Forum: Java Sep 23rd, 2009
Replies: 3
Views: 490
Posted By firstPerson
Try hitting alt+f6. Then click ok if a window pops up.
Forum: Java Sep 23rd, 2009
Replies: 6
Views: 951
Posted By firstPerson
use for loop. It will be conceptually easier.

int F =5;
int R = 1;
for i = F to i >1 ; i--
{
R equals R times F;
F equals F minus 1;
}
Showing results 1 to 40 of 53

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC