This site javatpoint is very useful for programming languages like JAVA,PYTHON,C,C++, Data Structures etc.Java learning Concept also provides technical materials , which are related to latest technologies. We provides very easy lectures to our viewers from beginning to advance level.We focus logical content instead of theoretical content.

Wednesday, 1 August 2018

RAILWAY APPLICATION IN JAVA

RAILWAY APPLICATION IN JAVA:


import java.util.Scanner;
class RailwayApplication
{
String name;
int age;
int phno;
String address;
int tikno;
double amount;
public void details()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter candidate name");
name=sc.next();
System.out.println("Enter candidate age");
age=sc.nextInt();
System.out.println("Enter candidate phone number");
phno=sc.nextInt();
System.out.println("Enter candidate address");
address=sc.next();
System.out.println("Enter candidate ticket number");
tikno=sc.nextInt();
System.out.println("Pay valid amount of charge");
amount=sc.nextDouble();
}
public void show()
{
System.out.println(" candidate name:"+name);
System.out.println(" candidate age:"+age);
System.out.println(" candidate phone number:"+phno);
System.out.println(" candidate  address:"+address);
System.out.println(" candidate ticket number:"+tikno);
System.out.println(" candidate pay amount:"+amount);
}
}
class Railway
{
public static void main(String[]args)
{
RailwayApplication  ra=new RailwayApplication();
ra.details();
ra.show();
}
}

Output:

Enter candidate name
jerry
Enter candidate age
19
Enter candidate phone number
123456
Enter candidate address
Newyork
Enter candidate ticket number
1029
Pay valid amount of charge
5000
 candidate name:jerry
 candidate age:19
 candidate phone number:123456
 candidate  address:Newyork
 candidate ticket number:1029
 candidate pay amount:5000.0
Adbox