In: Computer Science
Please write a java program that has the following methods in it: (preferably in order)
Design Notes:
Please copy the java code along with a screen print (snippet) of the final output. I would like both to review the work that I already have done. Thanks in advance!
Java class :
StudentsClass.java :
//import package
import java.util.*;
//Java class
public class StudentsClass {
// main() method
public static void main(String[] args) {
// call method to get university
name
String uniName =
universityName();
// call method to get number of
students
int numStudents =
numberOfStudents();
// call method to calculate tuition
fee
double tuition =
calculateTuitionFee(numStudents);
// call method to display
details
printDetails(uniName, numStudents,
tuition);
}
// a method to read in the name of a University and
pass it back
public static String universityName() {
// Object of Scanner class
Scanner sc = new
Scanner(System.in);
// asking user university
name
System.out.print("Enter University
Name : ");
// reading name
return sc.nextLine();
}
// a method to read in the number of students
enrolled and pass it back
public static int numberOfStudents() {
// Object of Scanner class
Scanner sc = new
Scanner(System.in);
// asking user number of
students
System.out.print("Enter number of
students : ");
// reading number of students
return sc.nextInt();
}
// a method to calculate the tuition as 20000 times
the number of students and
// pass it back
public static double calculateTuitionFee(int
numStudents) {
// calculate and return tuition
fee
return numStudents * 20000;
}
// a method print the name of the University, the
number of students enrolled,
// and the total tuition
public static void printDetails(String uniname, int
numStudents, double tuition) {
// print details
System.out.println("University Name
: " + uniname);// print university name
System.out.println("Number of
Students : " + numStudents);// print number of Students
System.out.println("Tuition Fee: "
+ tuition);// print tuition fee
}
}
=====================================
Output :