The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 314 Weeks Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
Please help me!
It's C# programming and I use Visual Studio 2015. I already did some works but it didn't work as I expected ... I want to refer another people's work so that I can find my mistakes by myself. Please sh
Programming
This is the most complex application that you have seen so far. It is comprised of six user defined types: four classes and two enums. This assignment attempts to simulate a simple version of a Theater application. In this application the user is able to search for a movie based on genre, name of actor, the time of the day and the day of the week.
You should define your types in the following order: the two enums, Time, Movie, Show and then Theater You will perform some simple queries on this collection.
Â
Â
Thistype represents the days of the week and is comprised of seven constants. The constants are the first three letters of the day of the week.
Â
This type represents the various categories of movie. Because a movie may fall under multiple categories, you will have to use the [Flags] to decorate this enum.
The bit-wise operator is used to combine more than one genre. E.g.MovieGenregenre = MovieGenre.Action | MovieGenre.Romance | MovieGenre.Comedy;
For this to work correctly, you will have to assign appropriate values for each name. Appropriate values are 0, 1, 2, 4, 8, 16, 32 etc.
Â
This type represents the days of the week.
Â
|
Time Class |
|
Properties |
|
+Â Hours{get; set;} : int +Â Minutes{get; set;}: int +Â Seconds{get; set;}: int |
|
Methods |
|
+Â Time(hours : int, minutes : int, seconds : int) +Â ToString() : string |
Â
All of the properties have public getters and private setters and are self-explanatory.
1.      Hours – this property is anint representing the hour. The getter is public and the setter is private.
2.      Minutes – this property is an int representing the minute. The getter is public and the setter is private.
3.      Seconds – this property is an int representing the second. The getter is public and the setter is private.
1.      Time(inthours, intminutes, intseconds) – This public constructortakes three int parameters and assigns them to the appropriate properties
2.      ToString() – This method overrides the same method of the Object class. It does not take any parameter but return a string representation of itself. You decide on the format for the output.
This class will model a movie.
Â
|
Movie Class |
|
Properties |
|
+Â Length{get; set;} : int +Â Title{get; set;}: string +Â Genre{get; set;}: MovieGenre +Â Cast{get; set;}: List<string> |
|
Methods |
|
+Â Movie(title : string, length : int) +Â AddActor(actor : string) : void +Â SetGenre(genre : MovieGenre) : void +Â ToString() : string |
Â
All of the properties have public getters and private setters and are self-explanatory.
1.      Length – this property is an int representing the length of the movie in minutes. The getter is public and the setter is private.
2.      Title – this property is a string representing the title of the movie. The getter is public and the setter is private.
3.      Genre – this property is an enum representing the genre of this movie. The getter is public and the setter is private.
4.      Cast – this property is a list of string representing the names of the actors in this movie. The getter is public and the setter is private.
1.      Movie(stringname, intlength) – This public constructor takes one string and one int parameter. It does the following:
a.        Assigns the arguments to the appropriate properties.
b.        Initialize the Cast property to
2.      AddActor(stringactor) – Thispublic method takes a single a string argument and adds it to the collection of actors (Cast).
3.      SetGenre(MovieGenre genre) – This public method takes a single enum argument and assigns it to the property of the same name.
4.      ToString() – This method overrides the same method of the Object class. It does not take any parameter but return a string representation of itself. You will need to build a single string comprising all of the actors in this movie. You decide on the format for the output.
This class models a movie show. You will also implement this in Visual Studio. A short description of the class members is given below:
|
Show Class |
|
Properties |
|
+Â Price{get; set;} : double +Â Day{get; set;} : MovieDay +Â Movie{get; set;} : Movie +Â Time{get; set;} : Time |
|
Methods |
|
+ Show(movie : Movie, day : MovieDay, price : double, time : Time ) + ToString() : string |
Â
Â
Â
Â
Â
Â
Â
Â
1.      Price – this property is a double representing the price of admission to this show. The getter is public and the setter is private.
2.      Day – this property is an enum representing the day of the week of this show. The getter is public and the setter is private.
3.      Movie – this property is an object reference of the movie class. The getter is public and the setter is private.
4.      Time – this property is an object of the Time class representing the time of this show. The getter is public and the setter is private.
1.      Show(Movie movie, MovieDay day, double price, Time time) – This is the public constructor that takes four arguments and assigns them to the appropriate properties.
2.      ToString() – This is the public method overrides the method of the same name in the object class to return a meaningful description of this object.
Â
This class models a theater. You will also implement this in Visual Studio. A short description of the class members is given below:
Â
|
Theatre Class |
|
Properties |
|
+Â Shows {get; set;} : List<Show> +Â Name{get; set;} : string |
|
Methods |
|
+Â Theater(name : string) +Â AddShow(show : Show) : void +Â PrintShows() : void +Â PrintShows(genre : MovieGenre) : void +Â PrintShows(day : MovieDay) : void +Â PrintShows(time : Time) : void +Â PrintShows(actor : string) : void |
Â
1.      Shows – this private field is a list of Show objects.The getter is public and the setter is private.
2.      Name – this private field is a string representing the name of the theater.
1.      Theater(stringname) – This is the public constructor that takes the name of the theater. This constructor does the following:
a.        Assigns the argument to the property.
b.        Initialize the Shows property to a new list of show
2.     Â
|
Again, this is a good example of method overloading |
AddShow(Show show) – This public method takes a show object and adds it to the collection of shows.
3.      PrintShows() – This public method does not take any argument neither does it return a value. It displays all the shows that is available.
4.      PrintShows(MovieGenregenre) – This public method takes a genre as an argument and display all the shows that contains the flag of this genre.
5.      PrintShows(MovieDay day) – This public method takes a day object as an argument and display all the shows matching this day object.
6.      PrintShows(Time time) – This public method takes a time object as an argument and display all the shows matching the hour value of this time object.
7.      PrintShows(string actor) – This public method takes a string representing the name of an actor as an argument and display all the shows that this actor appears in.
In your test harness (the Main() method in the Program Class), copy and paste the following code:
Movie terminator = newMovie("Judgement Day", 105);
terminator.AddActor("Arnold Schwarzenegger");
terminator.SetGenre(MovieGenre.Horror | MovieGenre.Action);
terminator.AddActor("Linda Hamilton");
Show s1 = newShow(terminator, MovieDay.Mon, 5.95, newTime(11, 35, 0));
Â
Console.WriteLine(s1);
Theater eglinton = newTheater("Cineplex");
eglinton.AddShow(s1);
eglinton.PrintShows();Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â //displays one object
Â
Movie godzilla = newMovie("Godzilla 2014", 123);
godzilla.AddActor("Aaron Johnson");
godzilla.AddActor("Ken Watanabe");
godzilla.AddActor("Elizabeth Olsen");
godzilla.SetGenre(MovieGenre.Action);
Â
Movie trancendence = newMovie("Transendence", 120);
trancendence.AddActor("Johnny Depp");
trancendence.AddActor("Morgan Freeman");
trancendence.SetGenre(MovieGenre.Comedy);
eglinton.AddShow(newShow(trancendence, MovieDay.Sun, 7.87, newTime(18, 5, 0)));
Â
Movie m1 = newMovie("The Shawshank Redemption", 120);
m1.AddActor("Tim Robbins");
m1.AddActor("Morgan Freeman");
m1.SetGenre(MovieGenre.Action);
eglinton.AddShow(newShow(m1, MovieDay.Sun, 8.87, newTime(14, 5, 0)));
Â
Â
m1 = newMovie("Olympus Has Fallen", 120);
m1.AddActor("Gerard Butler");
m1.AddActor("Morgan Freeman");
m1.SetGenre(MovieGenre.Action);
eglinton.AddShow(newShow(m1, MovieDay.Sun, 8.87, newTime(16, 5, 0)));
Â
m1 = newMovie("The Mask of Zorro", 136);
m1.AddActor("Antonio Banderas");
m1.AddActor("Anthony Hopkins");
m1.AddActor(" Catherine Zeta-Jones");
m1.SetGenre(MovieGenre.Action | MovieGenre.Romance);
eglinton.AddShow(newShow(m1, MovieDay.Sun, 8.87, newTime(16, 5, 0)));
Â
m1 = newMovie("Four Weddings and a Funeral", 117);
m1.AddActor("Hugh Grant");
m1.AddActor("Andie MacDowell");
m1.AddActor("Kristin Scott Thomas");
m1.SetGenre(MovieGenre.Comedy | MovieGenre.Romance);
eglinton.AddShow(newShow(m1, MovieDay.Sat, 8.87, newTime(15, 5, 0)));
Â
m1 = newMovie("You've Got Mail", 119);
m1.AddActor("Tom Hanks");
m1.AddActor("Meg Ryan");
m1.SetGenre(MovieGenre.Comedy | MovieGenre.Romance);
eglinton.AddShow(newShow(m1, MovieDay.Sat, 8.87, newTime(15, 5, 0)));
Â
Show s2 = newShow(godzilla, MovieDay.Mon, 6.89, newTime(13, 15, 0));
eglinton.AddShow(s2);
Â
s2 = newShow(godzilla, MovieDay.Sun, 6.89, newTime(14, 15, 0));
eglinton.AddShow(s2);
Â
s2 = newShow(godzilla, MovieDay.Sun, 6.89, newTime(16, 55, 0));
eglinton.AddShow(s2);
Â
eglinton.PrintShows();Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â //displays ten objects
Â
eglinton.PrintShows(MovieDay.Sun);Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â //displays six objects
Â
eglinton.PrintShows(MovieGenre.Action);Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â //displays seven objects
Â
eglinton.PrintShows(MovieGenre.Romance);Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â //displays three objects
Â
eglinton.PrintShows(MovieGenre.Action | MovieGenre.Romance); //displays one object
Â
eglinton.PrintShows("Morgan Freeman");Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â //displays three objects
Â
eglinton.PrintShows(newTime(14, 30, 0));Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â //displays two objects
ow me how u do it in all parts :(
Attachments:
----------- Â ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly