import java.util.*;
import java.text.*;
public class DvdRental1 {
static Scanner input = new Scanner(System.in).useDelimiter("\r\n");
static DecimalFormat fmt=new DecimalFormat("0.00");
public static void main(String[] args)
{
String [] movies = new String[10];
movies[0] = "DRAG ME TO HELL";
movies[1] = "PARANORMAL ACTIVITY";
movies[2] = "SHUTTER";
movies[3] = "P.S I LOVE YOU";
movies[4] = "500 DAYS OF SUMMER";
movies[5] = "THE NOTE BOOK";
movies[6] = "2012";
movies[7] = "THE DAY AFTER TOMORROW";
movies[8] = "GAMER";
showmainmenu();
} // END OF MAIN
private static void showmainmenu()
{
int perday;
int mainmenu;
System.out.println("Welcome to TP DVD Rental Service");
System.out.println("");
System.out.println("---DVD RENTAL SYSTEM---");
System.out.println("-----------------------");
System.out.println("(1) Rent a DVD");
System.out.println("(2) Exit");
System.out.print("Please select your choice(1-2):");
mainmenu= input.nextInt();
if(mainmenu ==1 )
{
showmenu();
}
else if (mainmenu == 2)
{
goExit();
System.out.println("You have exited");
}
else
System.out.println("Please key in 1,2");
}
}
This is my first time using Java
. I have another question whether this is the right way to make the program run this way, as will the showMenu()
method i am using will it cause to program to run endlessly ? Thank you so much. As i have most of my content using methods to do a loop.