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

Nils Hofmann

Greenhorn
+ Follow
since Jan 10, 2004
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 Nils Hofmann

to ensure that i understand you right. there exists two kinds of accounts saving accounts and chequing account. both have the same attributest (id, balance, annualInterestRate) and the same behavior regarding deposit but a different behavior regarding withdrawl. on an saving account only an amount that ist smaller than balance can be withdrawed, on a chequing account every amount can be withdrawed(in this assignment). then you have to build an abstract superclass, which includes the behaviour, that is the same for both chequing account and saving account with an abstract method withdrawl. then you build two subclasses, SavingsAccount and ChequingAccount which extends account and override the method withdrawl.(fred described something similar in detail)
you can to this for example in this way:


nils
17 years ago
hi,
you can find POI for exel here
nils
17 years ago
your comparable code doesn't work. you compare x with x, this will always result 0.
have a look at
Java-API
to see details about the compareTo-Method.
in the class from which x is an object of have to override the compareTo-Method and then you have to do a typcast to the class from which x is an object of, and not to the Comparable Interface.
...and why have the parameter in your willMarbleFit-Method to be from typ object?
nils
17 years ago
hi,
i would solve it in this way:



nils
17 years ago
hi,
it's a bit circuitous, but you can try the following. set up a second list (called newList)
with all possible numbers. when you call newList.removeAll(oldList) then in newList remain
only that numbers, which are not in oldList.
example:

nils
[ February 17, 2004: Message edited by: Nils Hofmann ]
17 years ago
Hi Stacey,
well, 'A' i at position 65, whereas 'a' is at postion 97.
So if you run your programm with the Parameter NoOn, the following
happened at the line

word.charAt(i) returns 78, the position of 'N'. 78-97=-19 and that
causes the Exception, because negative array indices are not allowed.
So, you have to replace the 'a' with and 'A', further the curly brace
for the if-statement should go 2 lines below, that this works correctly. that's all.
Nils
17 years ago
hi all,
the local testcenter wants not only the exam fees but also an additionally fee of 20 Euro. Is this common practice or should i look for another center ?
hi marie,
first, it seems that there is a general problem with the '*'-operator as argument (at least at windows), other operators work.
your program calculates everything twice because both expressions
if((operand1 >= 0) || (operand1 < 0)) and
if ((operand2 >= 0) || (operand2 < 0))
are always true.
the 'wrong input' message is always printed because it is not included into an else-statement.
nils
18 years ago