This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JAVA DISCREPANCY PROBLEM

 
Nathe Chan
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone explain to me what the teacher is trying to get me to do?? I have problems understanding the question.

Here is the question.

Classes:::
You must create at least 2 classes to start off with. These classes are in "MovieInfo.java" which will be given to you.

And, while I have the MOVIEINFO.JAVA file open, I have been - all the time - left with utter confusion on what to do next. Can you guys please give me some hints and a hand out?

Here is the incomplete code. And, the teacher wants us to fill the rest of the lines in. I suppose that these concepts would have to do with inheritance.



Can someone please give me a HINT of what to do next. I DON'T NEED THE ANSWERS .. just a push off the ground.

I am supposed to GET AND SET THESE VARIABLES and then later display the movie data in JList Boxes.

Thanks,

- Nathe
 
Ryan Beckett
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its hard to explain the concept so here whats one of the functions should look like. Its more of what to do rather than why.


 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm guessing that the "which" parameter is used to differentiate between DVDs and BluRays, so it could be either a "D" or a "B" (for example).
 
Nathe Chan
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I still don't get it.
 
Chuck Mondi
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For the getter methods, it looks like you need to use if logic to determine what to return. It looks like the constructor initializes the title and quantities for each format (DVD and Blu-ray) that are in stock. So, if you look at the getMovieStock(char which) method, how will that method know whether you want the stock number for the DVD or Blu-ray of say The Dark Knight? It uses the 'char which' method parameter. So if it uses a method parameter you will need to have if logic that will determine what stock number to return for the format the user requests. Here is what I would do. Use this type of logic for the other methods. Assume that types of movies have chars 'D' for DVD and 'B' for Blu-ray.



As you can see, if movie is a DVD it will return the intMovieDVD amount, otherwise the movie is a Blu-ray and it will return the stock amount of intMovieBlueRay. As I said before you need to use similar logic for your other methods including the setters. If not, how will they know what variables to update?
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nathe Chan: please have a look at this FAQ: it is rude to write all UPPERCASE like that.
 
Nathe Chan
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, I'll be aware of that next time. Sorry, I didn't know that it was a rude technique.

- Nathe
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apologies accepted
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic