Design a Java class, which is used as a data source for at least 8 different mov
ID: 3680052 • Letter: D
Question
Design a Java class, which is used as a data source for at least 8 different movies, where the name, description, category, price, and language for each movie can be retrieved [2.5]. b. Design a data model class to hold the data for each movie [2.5]. c. Design a custom layout in such a way that the logo and the name for each movie can be displayed. d. Develop an activity where the movies can be displayed using the custom layout specified above [3.5]. e. Enhance your app in such a way that, if a movie is clicked, you are taken to a second activity that enables the full display of the data relating to that movie as sent by the first activity [3]. f. Simulate a scenario where the user is allowed to purchase this movie via clicking on a "buy" button, which once clicked, the user is taken back to the first main activity with a message saying: "Thank you for buying the "title" movie, which costs... $" [3]. That is, the title and the price of the movie must be sent back from the second activity to the first.Explanation / Answer
a) Java class for the movie details retrieval is given below:
public class Movie
{
//member variables
String name;
String description;
String category;
String language;
Int price;
static int numbersOfMovies; //static variable to count the number of movies
//constructor with one argument
Movie(String m_name)
{
numbersOfMovies++;
name = m_name;
}
String getMovieName()
{
return name;
}
void setMovieDetails(String m_name, String m_descrp, String m_catg, String m_lang, Int m_price)
{
name = m_name;
description = m_descrp;
category = m_catg;
language = m_lang;
price = m_price;
}
String getMovieDescription()
{
return description;
}
String getMovieCategory()
{
return category;
}
String getMovieLanguage()
{
return language;
}
Int getMoviePrice()
{
return price;
}
}