
-----------------------------------
antitru5t
Sat Mar 14, 2009 10:53 pm

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
/////////////////////////////////////...



}


} 


[/code]


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

-----------------------------------
wtd
Sat Mar 14, 2009 11:51 pm

Re: JAVA Getting and setting methods?
-----------------------------------
Properly formatted code would help.

//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

-----------------------------------
wtd
Sat Mar 14, 2009 11:56 pm

RE:JAVA Getting and setting methods?
-----------------------------------
http://wiki.compsci.ca/index.php?title=Introduction_To_Java#Accessors
