Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Hosteller.java
import java.util.*; import java.lang.*; public class Student { static int studentid, departmentID; static String name, gender, phone; } public class Hosteller extends Student { static String hostelname ,Yes, No, rn, pn; static int roomnumber; static Scanner s=new Scanner (System.in); public void getHosteller () { System.out.println("student id"); studentid=s.nextInt(); System.out .println("student name "); name=s.next(); System.out.println("department id") ; departmentID=s.nextInt() ; System.out.println(" gender "); gender=s.next(); System.out.println(" phone number "); phone=s.next(); System. out. println("hostel name") ; hostelname=s.next() ; System.out.println(" roomnumber "); roomnumber=s.nextInt(); System.out.println(" Modify room number (Yes/No)"); rn=s.next(); if(Yes.equals(rn)) { System.out.println("new roomnumber ") ; rn=s.next() ; } System.out.println(" Modify phone number ") ; pn= s. next() ; if(Yes.equals(pn)) { System.out.println(" New phone number ") ; pn=s.next() ; } } } class Main { public static void main (String args[]) { Hosteller h=new Hosteller () ; System.out.println(" Enter the details ") ; h.getHosteller() ; } }
run
|
edit
|
history
|
help
0
exp 3
js
twelveDays
Project Euler #2
j
java.
Coding Numbers - Duplicate - Array
1.5
Kochergina_4
epeenconverter