Created
October 20, 2017 15:50
-
-
Save wudaown/3055d9d673c3281fef81dd0a7498f775 to your computer and use it in GitHub Desktop.
ListMovie.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.gp3.moblima.view.moviegoer; | |
import java.util.ArrayList; | |
import org.gp3.moblima.model.Movie; | |
import org.gp3.moblima.view.BaseMenu; | |
import org.gp3.moblima.view.Quit; | |
import static org.gp3.moblima.view.IOUtil.printMenuItems; | |
import static org.gp3.moblima.view.IOUtil.printTitle; | |
import static org.gp3.moblima.view.IOUtil.readChoice; | |
/** | |
* Created by zhangxinye on 19/10/17. | |
*/ | |
public class ListMoviesMenu extends BaseMenu { | |
public ListMoviesMenu(BaseMenu previousMenu) { | |
super(previousMenu); | |
} | |
@Override | |
public BaseMenu execute() { | |
printTitle("Movie Listing"); | |
ArrayList<String> choices = new ArrayList<>(); | |
choices.add("Movie Info"); | |
choices.add("Show Top 5 by sale"); | |
choices.add("Shop Top 5 by rating"); | |
choices.add("Quit"); | |
printMenuItems(choices, 0); | |
int c = readChoice("Choice (0-" + choices.size() + ") : ", choices.size()); | |
BaseMenu nextMenu = this; | |
switch (c) { | |
case 0: | |
Movie movie = new Movie(); | |
nextMenu = new MovieInfo(this, movie); | |
break; | |
case 1: | |
nextMenu = new ListMovieTopSale(this); | |
break; | |
case 2: | |
nextMenu = new ListMovieTopRate(this); | |
break; | |
case 3: | |
nextMenu = this.getPreviousMenu(); | |
break; | |
} | |
return nextMenu; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment