Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!

umut uzumcu

Ranch Hand
+ Follow
since Jan 10, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by umut uzumcu

Hi,
Can anybody help me to sort this out please.

class..
{
Object p=pList.getCap(); //either this
String s=pList.getCap(); //or this

//here I need to cast the Object or String (any will do) into double
//to send it as an argument to coldDrinks(int, double) method
sDB.coldDrinks(++coldDrinkNo,softDrinkPrice);
}


other class
{
Object/String getCap()
{
}
}


other class
{
coldDrinks(int, double)
{..}
}


Thanks in advance.
14 years ago
How can I put

unique_number(key) , name(value), surname(value), addres(value)

those information into the TreeMap? TreeMap takes 1 key and 1 value at a time, what is the way to put more value in the map for a key?
14 years ago
hi, here is my code

RecordClass rc has data No,name, color,owner
When i put the data into the TreeMap key is saved ok but the value(rc) not.

but if i just wanna save the No and the name in the TreeMap, thats working fine. eg. vdb.put(rc.getNo(),rc.getName());

Bur i need to save 1 key in the map and that key has to hold 3 values


What can be the problem?

public class DB
{
Map vdb=new TreeMap();
public void store(RecordClass rc)
{

vdb.put(rc.getNo(),rc);

System.out.println(vdb);
}
}
14 years ago
Garrett Rowe,


Yes i have to use validation methods as well, but here is the other problem, my validation methods shouldnt have return value, so how
the method will know was it valid or not if there is nothing turning
back to method? Validation method will be used with methods in the same class as well as from the other clasess.
Is anybody know how can i get the value from a method without returning it?
14 years ago
public static void validateDate(String date) throws InvalidRecord
{
int date=0;

try{
date=Integer.parseInt(input);

}catch(Exception e)
{
throw new InvalidRecord("Date must be numeric");

}
}

public class InvalidRecord extends Exception
{
InvalidRecord(String invalid)
{
super(invalid);
}
}

For example on the code above I have to have the class called InvalidRecord and specify the exact error for all methods and different errors. and my code should continue after throwing the exception, it shouldnt terminate according to my project.
14 years ago
I dont know why, its not working in my code, the printStackTrace();

gives me error "cannot resolve symbol".
14 years ago
Joanne Neal,
yes your code is working continuously but it doesnt give any exception error, so its working like a plain while loop. I need to throw an exception and give user an error message like "date should be numeric" and allow them to try again.
14 years ago
public static void main(String args[]) throws InvalidRecord
{

String input=JOptionPane.showInputDialog("\n\tEnter the date of the registration..");


int date=0;

try{
date=Integer.parseInt(input);

}catch(NumberFormatException nfe)
{
throw new InvalidRecord("Date must be numeric");
}


VehicleRecord vr=new VehicleRecord("bnh",date,"ford","escord","colour");

}


for example here, the exception is thrown is user enter non numeric data, and then program stops working, how can i continue coding? for exmaple how can i make user to enter the data again?
14 years ago
Hi all,

Is it possible that the program coninues running after the Exception thrown?
14 years ago
I m looking for all different possibilities,
Not less or more than 5 numbers.
no repetition of the same number in the group. (1,2,1,3,5) is not valid
order doesnt make difference (1,2,3,4,5) and (5,4,3,2,1) are same


Pablo Muller
The formula you send
C(n,m)=n!/(m!(n-m)!)
I think this is what i was looking for.


thank you all
14 years ago
Hi,
Does anybody know the formula to claculate the posibility

ex. I have 10 numbers and i wanna choose 5 numbers randomly.
What is the formula to find out how many different group of 5 numbers I can choose.
14 years ago


is that the solution you were looking for? Thats what i could do check it out.
[ January 30, 2007: Message edited by: Fred Rosenberger ]
14 years ago


here I can get the entered double withdraw amount but the problem is I dont know how can I prevent the user to enter letters or punctuations(anything else than number.)?
15 years ago
So for example
There is two Account types(Student and Platinum) which they both can use the methods Withdraw and Deposit. But the Student account cant Overdraft. And they both Interest paying type of accounts.

In that situation is my code right?


[ January 19, 2007: Message edited by: umut uzumcu ]
15 years ago
Thank you Adam that was helpful.

So what about interface, its seems very similar to abstract
15 years ago