shea terry

Greenhorn
+ Follow
since Apr 08, 2019
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by shea terry

Paul Clapham wrote:... or maybe Auctions is a variable referring to a list of Auction objects? Standard practice in Java is for class names to start with capital letters and for variable and method names to start with lower-case letters. So Auctions should be a class. However I see you have methods whose names start with capital letters, so we're left guessing about Auctions.


So there is a linked list called Auctions

There is a class called Auction which is in my reply before this
the public method Auction holds constructors for the data types being held in the linked list, one of which is the AuctionID.
I want to call the auctionID from the class Auction with the getAuctionID() method. However when i declare this it gives the error referring to not being able to compare static and non static values
5 years ago
Ok so ive quickly reverted back to my original code that works when the variables are set as a static (I havent set them as static per the errors)
the error is Cannot make a static reference to the non-static method getAuctionID() from the type Auction

this is the entire account class so that you can grasp why i am trying to call from it (Needs formatting i think)


If youd be able to shed any light i would very much appreciate it
5 years ago

Paul Clapham wrote:You seem to be concerned by the fact that startPrice is zero. And your debugging code seems to confirm that fact.

But on the other hand I don't see any code which sets that variable to anything. For that matter I don't even see any code which declares that variable. So the fact that it is zero is totally unsurprising to me. What reason do you have for expecting it to have some other value?



So im trying to pull it from a linked list where it is defined as a constructor in the Account class
5 years ago

Campbell Ritchie wrote:Welcome to the Ranch
. . . .



Much appreciated. The poor formatting is down to a frantic group effort and was going to attempt to tidy but thank you for the help with that.
So the requirement is that the user must place a bid within 10 and 20% of the start/current bid. Awkward i know but that is the spec unfortunately.
A lot of the code is for me trying to troubleshoot how to do it such as the sys.print(a.getAuctionID)
The reason i have a new auction object is as i cannot use Auction.getAuctionID as it is called from a non static environment i have a picture of my original code which this has developed from which is a lot easier and simple to follow.
5 years ago



So this is my code (sorry if incorrectly formatted im not sure how to)

the premise of the code is for me to fetch details about an item in order for a user to then bid on them. the bid must be an increment of atleast 10% but less than 20% of the start/current price
With my current code i get the flowing outputted

Please enter the id of the auction you would like to place a bid on?
1
Startprice0.0 //troubleshooting
0.0 //troubleshooting
Auction ID 1
Lower 0.0 //troubleshooting
upper 1.2 //troubleshooting
1: £20.0 £150.0 null item Name: Dog  Status: a Seller:  Dave

Please enter a value between £0.0 and £1.2

So my predicament is that while ive been able to index the stored items correctly using the auction id my startPrice is being set as 0 as is show with he fact the upperIncrement is set to 1.2

Any help


5 years ago