Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Page 2 of 2 FirstFirst 12
Results 26 to 33 of 33

Thread: Find Highest rated movie

  1. #26
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,162
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Find Highest rated movie

    What is "s"? variable names should show what the contents of the variable. "s" has no meaning.

    Did you read my last post? The method that builds the Vector still does not return it so other methods can use it.

    The code's formatting is still poor.
    If you don't understand my answer, don't ignore it, ask a question.

  2. #27
    Junior Member
    Join Date
    Mar 2014
    Posts
    26
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Find Highest rated movie

    s is the variable rating
    i dont know how else to format the code

  3. #28
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,162
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Find Highest rated movie

    A better name would be currMaxRating??? instead of s. Does it hold an index or is it a reference to a film object or the value of the max rating?

    how else to format the code
    Format it so that the }s are in the same column beneath the start of the line that has the {

    Very few things should be in the first column:
    public class
    and the ending } for the class.
    If you don't understand my answer, don't ignore it, ask a question.

  4. #29
    Junior Member
    Join Date
    Mar 2014
    Posts
    26
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Find Highest rated movie

    it holds the value of the rating

  5. #30
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,162
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Find Highest rated movie

    The code has to save where that value came from.
    Either a reference to the object
    or an index into the Vector for where that object is stored.
    If you don't understand my answer, don't ignore it, ask a question.

  6. #31
    Junior Member
    Join Date
    Mar 2014
    Posts
    26
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Find Highest rated movie

    I have it printing out the highest rated film now not sue if its the correct way but its doing waht i want it to do thanks for the help

    //******************QUESTION**********************\\

    Create a simple text file that contains information on Films like that in question 1. The format of the file may look like this:
    Top Gun, Tom Cruise, 110, 3.7, 1012
    Training Day, Denzel Washington, 122, 4.5, 21786
    .....
    5 or 6 entries will suffice for this example but your program should work with many more.
    Write a Java method called populateFilmVector(String path) to do the following:
    i. Read the Film file line by line and tokenize each line to get the Film attributes.
    ii. Create a Film object from the tokens (You may need to do some type conversions here).
    iii. Add the Film object to the Vector (this Vector will be a class variable with class scope)

    Question 3
    Write a method called bestFilm() that searches through the FilmVector and returns the best film based on the ratings. The method should return the Film object


    ************************************************** ***************

    that was the program i had to write

  7. #32
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,162
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Find Highest rated movie

    That's a start. As you get more experience you'll be able to improve the techniques you've used.
    If you don't understand my answer, don't ignore it, ask a question.

  8. The Following User Says Thank You to Norm For This Useful Post:

    dubs4sam (April 18th, 2014)

  9. #33
    Junior Member
    Join Date
    Mar 2014
    Posts
    26
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Find Highest rated movie

    thanks for your help

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Movie of BufferedImages
    By Ludicrous in forum What's Wrong With My Code?
    Replies: 2
    Last Post: September 26th, 2013, 07:09 PM
  2. Printing highest number of array. Can't find my error.
    By Praetorian in forum What's Wrong With My Code?
    Replies: 2
    Last Post: March 15th, 2013, 11:46 PM
  3. Top Java frameworks as rated by developers
    By pjagielski in forum The Cafe
    Replies: 0
    Last Post: August 15th, 2012, 12:05 PM
  4. Replies: 4
    Last Post: June 10th, 2009, 01:04 AM