• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

JAVA DISCREPANCY PROBLEM

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.


 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I still don't get it.
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Marshal
Posts: 80637
471
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 80637
471
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Apologies accepted
 
reply
    Bookmark Topic Watch Topic
  • New Topic