Create a new project, then create a new class named as StudentInfo , implement t
ID: 1996146 • Letter: C
Question
Create a new project, then create a new class named as StudentInfo, implement this project and display two messages and get the inputs from user. The first message is to ask user to enter the name. The second message is to ask user to enter the T Number. Two methods have to be included in this project, one is to display name and the other one to display the T Number.
Hint: use Scanner class in Java. You may refer:
http://www.cs.utexas.edu/users/ndale/Scanner.html
https://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html
Explanation / Answer
package Sample;
import java.util.Scanner;
public class Example {
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
int TNumber;
String Name;
System.out.println(" Enter name :: ");
Name=in.next();
System.out.println(" Enter T number :: ");
TNumber=in.nextInt();
getStudentName(Name);
gettNumer(TNumber);
}
public static void getStudentName(String name)
{
System.out.println("Name is: " + name);
}
public static void gettNumer(int TNumber)
{
System.out.println("TNumber: " + TNumber);
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.