• Post Reply Bookmark Topic Watch Topic
  • New Topic

for each loops  RSS feed

 
Gary Doyle
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all im just wondering is anyone able to help me with a college project.
it is as follows
1. add a close method to the class. this should iterate over the collection of lots and print out details of all the lots. You may use a "for each" loop and any lot that has had at least one bid is considered sold. for lots that have been sold, the details should include the name of the successful bidder, and the value of the winning bid. for lots that have not been sold, print a message indicating the fact.

2.add get unSold method to the Auction class with following signature
public ArrayList<Lot> getUnsold()
This method should itterate over the lots field, storing the unsold lots in a new arraylist local variable. at the end of the method, return the list of unsold lots.

Thanks in advance ( IM REALLY STUCK WITH THIS PLEASE HELP)
Screenshot-(1).png
[Thumbnail for Screenshot-(1).png]
Screenshot-(2).png
[Thumbnail for Screenshot-(2).png]
Screenshot-(3).png
[Thumbnail for Screenshot-(3).png]
 
Les Morgan
Rancher
Posts: 768
19
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Part of the things required of a good programmer is the ability to communicate effectively, as such, often times you need to vocalize how it is that you need help and on what part of the code. That means a specific question to get you moving again, not a "here is my project dumped in your lap and please do it for me" type of approach. Perhaps I am taking your meaning wrong, which I have been known to do, but without a specific question, it is difficult to render any specific aid to you concerning your project.

To illustrate what I mean, I could just give you a link to the API and say all your questions have been answered.

What you have listed is a significant portion of your assignment, as such, it would be fitting that the person doing it get the credit and not yourself, but if you ask specific questions then we can nudge you along your way without being entitled to take credit for doing your work.
 
Gary Doyle
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry i should have been more specific then just help with this. The part i'm stuck on is literally making sense of the questions, its my first semester doing this and its more the way its asked then whats asked is the problem. I know this isn't english class but maybe you could help with it?...
 
Les Morgan
Rancher
Posts: 768
19
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gary Doyle wrote:
1. add a close method to the class.

Gary Doyle wrote:
(1a)this should iterate over the collection of lots

Gary Doyle wrote:
(1b)and print out details of all the lots.

Gary Doyle wrote:
(1c)You may use a "for each" loop

Gary Doyle wrote:
(1d)and any lot that has had at least one bid is considered sold.

Gary Doyle wrote:
(1e)for lots that have been sold, the details should include the name of the successful bidder, and the value of the winning bid.

Gary Doyle wrote:
(1f)for lots that have not been sold, print a message indicating the fact.


Gary Doyle wrote:
2.add get unSold method to the Auction class

Gary Doyle wrote:
(2a) with following signature public ArrayList<Lot> getUnsold()

Gary Doyle wrote:
(2b)This method should itterate over the lots field,

Gary Doyle wrote:
(2c)storing the unsold lots in a new arraylist local variable.

Gary Doyle wrote:
(2d)at the end of the method, return the list of unsold lots.


Please supply the appropriate part identifier (1 - 2d) and furnish specific questions and supporting code showing what you have done and were you need the help for any further comments.
 
Carey Brown
Bartender
Posts: 3011
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please post all code, error messages, input, and output AS TEXT (i.e. cut & paste), not screen shots. Use code tags for all code. Make sure code is properly indented.
Help us to help you.
 
Carey Brown
Bartender
Posts: 3011
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would say the first step would be to get what you have to compile.
Example:

Class names should start with an upper case letter, hence "System" should start with an upper case letter. Java is case sensitive.
Variable names, e.g. "Bid", should start with a lower case letter.
Your use of "=" in your if() statement assigns null to bid. To compare the two use "==".

Also, you'll need to supply other classes as well. We can't compile without Bid and Lot.

Please use code tags. When posting your code, highlight your code and then click the "Code" button on the edit screen.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!