Eclipse (Problem with combining 2 codes together)
hi, I have 2 pieces of code and I don't know how to combine together. Hope someone can help me combine it together. And I also want to add in if (inputs.equals("@")) it will print time else (inputs.equals("!")), it will print hall. Below is my code for time and hall.
import java.util.Scanner;
public class Hall {
public static void main(String[] args) {
int userInput = 0;
System.out.print("Enter Hall Number (Between 1 to 3): ");
Scanner scan = new Scanner(System.in);
userInput = scan.nextInt();
System.out.println(" ");
{
if (userInput == 1) {
//Based on Hall number
// for movie showing in Hall 1
System.out.println(" ~~~~~~~~~~ Hall 1 ~~~~~~~~~~");
System.out.println("Movid ID: 1 Title: Inception Time: 4pm");
System.out.println("Movie ID: 2 Title: Twelve Time: 6pm");
System.out.println("Movie ID: 3 Title: The Sorcerer's Apprentice Time: 8pm");
}
// for movie showing in Hall 2
else if (userInput == 2){
System.out.println(" ~~~~~~~~~~ Hall 2 ~~~~~~~~~~");
System.out.println("Movie ID: 4 Title: Toy Story 3 Time: 3pm");
System.out.println("Movie ID: 5 Title: Toy Story 3 Time: 5pm");
System.out.println("Movie ID: 6 Title: Twelve Time: 7pm");
System.out.println("Movie ID: 7 Title: Predator Time: 9pm");
}
// for movie showing in Hall 3
else if (userInput == 3){
System.out.println(" ~~~~~~~~~~ Hall 3 ~~~~~~~~~~");
System.out.println("Movie ID: 8 Title: Knight and Day Time: 3pm");
System.out.println("Movie ID: 9 Title: The Twilight Saga: Eclipse Time: 5pm");
System.out.println("Movie ID: 10 Title: The Twilight Saga: Eclipse Time: 7pm");
System.out.println("Movie ID: 11 Title: Predator Time: 9pm");
}
else{
System.out.println("Sorry, there is no Hall " + userInput + ".");
}}}}
import java.util.Scanner;
public class Time {
public static void main(String[] args) {
int userInput = 0;
System.out.print("Enter Movie Time That You Prefer: ");
Scanner scan = new Scanner(System.in);
userInput = scan.nextInt();
System.out.println(" ");
//Based on Screening Time
//for movie showing at 4pm
if (userInput == 4){
System.out.println("Hall: 1 Movie ID: 1 Movie: Inception ");
}
//for movie showing at 6pm
else if (userInput == 6){
System.out.println("Hall 1: Movie ID: 2 Movie: Twelve ");
}
//for movie showing at 8pm
else if (userInput == 8){
System.out.println("Hall 1: Movie ID: 3 Movie: The Sorcerer's Apprentice ");
}
//for movie showing at 3pm
else if (userInput == 3){
System.out.println("Hall 2: Movie ID: 4 Movie: Toy Story 3 ");
System.out.println("Hall 3: Movie ID: 8 Movie: Knight and Day ");
}
//for movie showing at 5pm
else if (userInput == 5){
System.out.println("Hall 2: Movie ID: 5 Movie: Toy Story 3 ");
System.out.println("Hall 3: Movie ID: 9 Movie: The Twilight Saga: Eclipse ");
}
//for movie showing at 7pm
else if (userInput == 7){
System.out.println("Hall 2: Movie ID: 6 Movie: Twelve ");
System.out.println("Hall 3: Movie ID: 10 Movie: The Twilight Saga: Eclipse ");
}
//for movie showing at 9pm
else if (userInput == 9){
System.out.println("Hall 2: Movie ID: 7 Movie: Predator ");
System.out.println("Hall 3: Movie ID: 11 Movie: Predator ");
}
else{
System.out.println("Sorry, there is no movie showing at " + userInput + " O'clock.");
}}}
Thanks in advance
View Answers
Related Tutorials/Questions & Answers:
Advertisements
Eclipse hibernate problemEclipse hibernate problem hie..i've just started a basic hibernate application using
eclipse helios.I have added the jars,configured the xml files...;Hibernate
Eclipse Integration
Hibernate Tutorials
My Eclipse deployed problem. - StrutsMy
Eclipse deployed
problem. Dear All,
I am facing a
problem. When First time I am deploying a web project in
eclipse in jboss its fine but, when I am changing the project name by pressing 'f2' and then deploying
Eclipse Eclipse I am new to
eclipse. i want to create a login page in
eclipse and want to connect with mysql. what are the software and jar file i need to include in
eclipse EclipseEclipse how to compile using
eclipse eclipseeclipse Hi
how to debug in
eclipse ide and how to find bug in
eclipse ?
Thanks
kalins naik
eclipseeclipse how to add tomcat server first time in
eclipse EclipseEclipse I am new to
eclipse. I want to write a jsp program and want to connect it with mysql. What are the configurations i need to check in
eclipse EclipseEclipse How to develope web application servlets or jsp using
eclipse id
Eclipse Plunging/UML;
Borland
Together Edition for
Eclipse
Borland
Together Edition for
Eclipse is an integrated and agile design
environment...
combining the open-source
Eclipse platform with the power of
the Unified
Struts 2 Eclipse Plugin
Struts
2 Eclipse Plugin
This page contains the examples and the list of plugins
that are available for Struts
2...;
If anyone of you know the
Eclipse plugin for Struts
2,
kindly post
Borland Together Edition for Eclipse Borland
Together Edition for
Eclipse
Borland®
Together® is a visual modeling platform... or extracting
design information from existing systems,
Together gives all
Struts 2 Hello World Application using EclipseCreating Hello World application in Struts
2 version 2.3.15.1 using
Eclipse...
applications based on Struts
2 Framework. Here we have used
Eclipse IDE for
creating... will help you in writing your first Struts
2 applications using
Eclipse IDE. You can
Maven 2 Eclipse Plug-in
Maven
2 Eclipse Plug-in
...://www.eclipse.org/downloads/
2. Get Maven-
eclipse-plugin-plugin :
... the
Maven Plugin with your
eclipse IDE.
Why Maven with
Eclipse
ADS_TO_REPLACE_1
Eclipse
Eclipse
Eclipse... a development environment from plug-in
components. Fortunately,
Eclipse comes... can also extend its
capabilities by installing plug-ins written for the
Eclipse Eclipse erroeEclipse erroe Dear Sir,
I am facing a
problem while check out a project from the repository
error is org.tigris.subversion.javahl.clientException: RA layer request failed
eclipse - StrutsEclipse keyboard shortcuts I need a list of
eclipse keyboard shortcuts.Thanks
Debug in EclipseDebug in Eclipse How to debug a java application in
Eclipse Helio version
deployment in eclipsedeployment in eclipse How to run the web project in
eclipse in resin server without using GUI hard deployment
eclipse+wampservereclipse+wampserver when i run my mobile appilcation code in
eclipse i get an error, ClassNotFoundException: com.mysql.jdbc.Driver
SQLException: No suitable driver found for jdbc:mysql://127.0.0.1/plants.
i have already created
Maven with eclipseMaven with eclipse Hai friends i m new to maven and quartz scheduler. I run the simple Helloworld quartz scheduler program as maven project in
eclipse successfully. Now i want to cluster the same program in terracotta quartz
Question in Eclipse Question in
Eclipse ** Hello EveryOne , L Have Question in
Eclipse ?!!
Question is :
A.( The square class) Design a class named Square that contains :
1.A private instance variable side of type double
2.A no-argument
Question in Eclipse ??Question in
Eclipse ?? ** Hello EveryOne , L Have Question in
Eclipse ?!!
Question is :
A.( The square class) Design a class named Square that contains :
1.A private instance variable side of type double
2.A no-argument
Lint4j Eclipse Plugin Lint4j
Eclipse Plugin
Eclipse is the perfect environment for using Lint4j.
Problems can be reported as soon as the source is saved, and the
Eclipse problem SJ Eclipse SJ
Eclipse
SJ
Eclipse is an
Eclipse plugin that allows users to
interact with a SourceJammer archive. Once you install SJ
Eclipse, the first
thing you should
java,eclipse - Swing AWTjava,eclipse Hi,
I have made on program SimpleCalculator on
eclipse 3.4.0.But while running the code I am getting the
problem for Class File Editor... descriptor #
2 (Ljava/lang/String;)V
// Stack:
2, Locals:
2
public
Maven Repository/Dependency: eclipse | eclipse-uiMaven Repository/Dependency of Group ID
eclipse and Artifact ID
eclipse-ui. Latest version of
eclipse:
eclipse-ui dependencies... Application in
Eclipse?
Maven 3 Tutorial
Convert Maven project to
Eclipse Web
Maven Repository/Dependency: eclipse | eclipse-jfaceMaven Repository/Dependency of Group ID
eclipse and Artifact ID
eclipse-jface. Latest version of
eclipse:
eclipse-jface dependencies... Application in
Eclipse?
Maven 3 Tutorial
Convert Maven project to
Eclipse Maven Repository/Dependency: eclipse | eclipse-bootMaven Repository/Dependency of Group ID
eclipse and Artifact ID
eclipse-boot. Latest version of
eclipse:
eclipse-boot dependencies... is Apache Maven?
How to create Maven Web Application in
Eclipse?
Maven 3
Eclipse-Apache tomcat errorEclipse-Apache tomcat error Hi..I'v been trying to install apache tomcat 7 with
eclipse helios to try web applications
..but unable to run webcontents .it gives the folowing msg in
eclipse:Several ports (8005, 8080, 8009
Error In starting Glassfish in Eclipse.Error In starting Glassfish in
Eclipse. Sir,I am new in Java/J2EE.And i am learning j2ee by regular study of your site.
I am facing a
problem in
eclipse when i use Glassfish as server.I have installed Glassfish in C:\Glassfish
Eclipse Goodies Eclipse Goodies
Eclipse Goodies is a set of open source released
Eclipse-plugins and tools for the
Eclipse RCP and other
Eclipse projects like
BIRT or GEF we
Tikal Eclipse Tikal
Eclipse
Tikal
Eclipse is an open source
Eclipse-based distro
which combines the
Eclipse binaries with a broad range of
Eclipse plugins for
Java, Java
websphere IDE and eclipse IDEwebsphere IDE and
eclipse IDE can we work struts framework in
eclipse IDE. i am working in trial version of websphere studio application developer . if i work in
eclipse all the features are available in
eclipse Tomcat Configuration For Eclipse Server on
eclipse
1)First download the tomcat and install it on your hard drive.
2)Run the
eclipse. Clicks on the window menu and then Preferences menu item.
3)Now...Tomcat Configuration For
Eclipse Server How to configure
Eclipse plugins in eclipse heliosplugins in
eclipse helios How to add the capabilities of already builtin plugins to the project in
eclipse helios