Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 JAVA Getting and setting methods?
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
antitru5t




PostPosted: Sat Mar 14, 2009 10:53 pm   Post subject: JAVA Getting and setting methods?

I seriously have no clue on how to do this part of my JAVA assignment. I need some serious help here. Once I finish getting and setting these methods, I need to display these movie data in theri respective JList boxes. The teacher absolutely covered none of this class and HE EXPECTS US TO DO THIS ON AN ASSIGNMENT. omg~

I need some serious helping here. =(

Thanks.

Here's the unknown source code that I have trouble in.

Can you explain to me how to complete the rest of this code?

code:


//For Assign3 Winter 2009

class MovieInfo
{

private String strMovieTitle;
private int intMovieDVD;
private int intMovieBlueRay;

private static double doubMovieDVDPrice;
private static double doubMovieBlueRayPrice;

MovieInfo(String title, int mDVD, int mBRay)
{

strMovieTitle = title;
intMovieDVD = mDVD;
intMovieBlueRay = mBRay;


}

public String getMovieTitle()
{
return strMovieTitle;
}


public int getMovieStock(char which)
{
// you finish this
// You can use "which" to determine which
// type of movie to retrieve the stock for

}


public static double getMoviePrice(char which)
{
// you finish this
// You can use "which" to determine which
// type of movie to retrieve the stock for

}



public void setMovieStock(char which, int amt)
{
// you finish this
// You can use "which" to determine which
// type of movie to set the stock for
}


public static void setMoviePrice(char which, double prce)
{
// you finish this
// You can use "which" to determine which
// type of movie to set the price for
}



}

///////////////////////////////

class MovieList
{

MovieInfo[] mList;

public void createList()
{

mList = new MovieInfo[7];
mList[0] = new MovieInfo("Speed Racer",50,23);
mList[1] = new MovieInfo("Star Trek XI",3,0);
mList[2] = new MovieInfo("The Dark Knight",0,78);
mList[3] = new MovieInfo("The X Files 2",34,5);
mList[4] = new MovieInfo("Hulk",78,100);
mList[5] = new MovieInfo("Iron Man", 0,0);
mList[6] = new MovieInfo("Made of Honor",25,56);

/////////////////////////////////////...
// IMPORTANT: PLEASE use "setMoviePrice()" method to
// set the PRICES FOR dvd OR BLU RAY HERE
// 19.99 FOR DVD
// 35.99 for Blu Ray
/////////////////////////////////////...



}


}





I need immediate help as soon as possible, and I'm it has been depressive so far.. . not knowing how to solve this scenario.

- Nathe
Sponsor
Sponsor
Sponsor
sponsor
wtd




PostPosted: Sat Mar 14, 2009 11:51 pm   Post subject: Re: JAVA Getting and setting methods?

Properly formatted code would help.

Java:
//For Assign3 Winter 2009

class MovieInfo {
        private String strMovieTitle;
        private int intMovieDVD;
        private int intMovieBlueRay;

        private static double doubMovieDVDPrice;
        private static double doubMovieBlueRayPrice;

        MovieInfo(String title, int mDVD, int mBRay) {

                strMovieTitle = title;
                intMovieDVD = mDVD;
                intMovieBlueRay = mBRay;
        }

        public String getMovieTitle() { 
                return strMovieTitle;
        }       

        public int getMovieStock(char which) {
                // you finish this
                // You can use "which" to determine which
                // type of movie to retrieve the stock for
        }

        public static double getMoviePrice(char which) {
                // you finish this
                // You can use "which" to determine which
                // type of movie to retrieve the stock for
        }

        public void setMovieStock(char which, int amt) {
                // you finish this
                // You can use "which" to determine which
                // type of movie to set the stock for
        }

        public static void setMoviePrice(char which, double prce) {
                // you finish this
                // You can use "which" to determine which
                // type of movie to set the price for
        }
}

///////////////////////////////

class MovieList {
        MovieInfo[] mList;

        public void createList() {
                mList = new MovieInfo[7];
                mList[0] = new MovieInfo("Speed Racer",50,23);
                mList[1] = new MovieInfo("Star Trek XI",3,0);
                mList[2] = new MovieInfo("The Dark Knight",0,78);
                mList[3] = new MovieInfo("The X Files 2",34,5);
                mList[4] = new MovieInfo("Hulk",78,100);
                mList[5] = new MovieInfo("Iron Man", 0,0);
                mList[6] = new MovieInfo("Made of Honor",25,56);

                /////////////////////////////////////...
                // IMPORTANT: PLEASE use "setMoviePrice()" method to
                // set the PRICES FOR dvd OR BLU RAY HERE
                // 19.99 FOR DVD
                // 35.99 for Blu Ray
                /////////////////////////////////////...
        }
}
wtd




PostPosted: Sat Mar 14, 2009 11:56 pm   Post subject: RE:JAVA Getting and setting methods?

http://wiki.compsci.ca/index.php?title=Introduction_To_Java#Accessors
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: