9) Most people enjoy watching movies these days, whether its the classics or mod
ID: 3758735 • Letter: 9
Question
9) Most people enjoy watching movies these days, whether its the classics or modern ones. Develop a set of structures that could be used to model the information about a movie collection. What type of information would you want to collect and store about a movie? What would be the right types in C for that information? Define supporting structures as needed and have one final structure type that is made up of various members (some members may be on some structure type, others may be simple integers, floats, chars, arrays, etc). No program is needed although you might want to create a simple main function and include your structure types just to test that everything compiles. This question is similar to the final question on the midterm, but you have learned about many different types since then. Here is a template to use to get started and indicates what I am looking for in your answer. Use everything you learned this semester, especially types from the last set of lectures notes.
/* add supporting structures - expect many structure types here ... date is good example */
struct date { int month; int day; int year; }; /* add other supporting structures */
/* Final structure, such as struct movie */ struct movie { /* some members may be a structure type themselves, here is an example */ struct date releaseDate; /* the date the movie was released */
/* other members may be ints, floats, doubles, chars, enum, ... */ char title [100]; /* the title of the move */
/* add others */ };
int main ( ) { struct movie myMovie [1000];
/* nothing else needs to be added to main */
return (0); };
Explanation / Answer
Answer:
Modified Code:
struct date
{
int month;
int day;
int year;
};
struct Artist
{
char ArtistFirstName [100];
char ArtistLastName [100];
};
struct Music
{
char musicDirector[100];
float timeTakenToCompose;
};
struct movie
{
struct date releaseDate; /* the date the movie was released */
char title [100]; /* the title of the move */
struct Artist ArtistInfo; /* Information of Artist */
struct Music MusicInfo;
int chapterNum; /* number of sub-titles or chapters in the movie*/
enum {ACTION,COMEDY} movieGenre; /*enum for movie genre */
double costSpend; /* cost spent to take the movie */
char directorName[100];/* movie director */
char movieDescription[100]; /*describes the movie */
int movieRating; /*rating for the movie*/
};
int main ( )
{
struct movie myMovie [100]; /* this should be less than 1000 , if we use array size 1000 it shows error*/
/* nothing else needs to be added to main */
return (0);
};
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.