• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Help understanding OOP-4 Lookup Rules.

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey  I just joined the Cattle Drive and have been diligently working at completing the tasks.  I have experience in Visual Basic but no prior study in Java.  This is a rush of new information but I think I am going through at a reasonable pace and this forum is a great help.

My question is about the OOP-4 Lookup assignment.  

I do not know what I am supposed to be doing.  I read about polymorphism and I understand the concept. I also understand the image showing inheritance.  

What I do not understand is what I am supposed to be doing.  No idea what the goal is.  Can anyone explain the task a bit more clearly to me?  I would really appreciate it.
 
Sheriff
Posts: 6039
157
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Write a program called Lookup that takes in a serial number and writes information on a given item to the console.


So that's the goal.  I don't know how much I should be giving away in terms of coding, but think about how you would implement just this.  You'd probably use a Map with a String for the serial number and a String for the description.

You will need to make an abstract class called Thing and three subclasses: Video, BookOnTape and Furniture. There will be an abstract method called getDescription() that returns a String.


So now you know the structure of the classes.  You will still use a Map with a String for the serial number, but the description now come from some place else.  What is the Map going to look like now?
 
Rob Mihalko
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can see that, but...

I might be missing something here, but from what I can tell the map stores a "number" and a description... You want to give a number and get the description... Whats the point of all the other classes? The description is in the map.   I might be dense but this just sounds like a simple one class kind of problem with a hashmap...  It says we should keep it simple to solve the problem so I am lost as to what all the complexity is for.

 I don't know how much I should be giving away in terms of coding,



That being said.. I understand if you cannot give away any more information than you already have.  I might figure it out eventually or just skip it.
 
Knute Snortum
Sheriff
Posts: 6039
157
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But what if the description wasn't in the map, only the reference to an object?  And what if you had a bunch of different classes but all had a similar interface or method?
 
Rob Mihalko
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok. I think I get you... A lot more clear.  I'll give it a try.  Thank you for your help.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!