======================================= Student.java ======================================= import java.util.Scanner; public class Student { Scanner scanner = new Scanner (System.in); String student1, student2 = ""; int s1Score1, s1Score2, s2Score1, s2Score2 = 0; double average1, average2 = 0; //Student Name public Student (String s1, String s2) { student1 = s1; student2 = s2; } //return student1's name back to Grades public String getStudentName1() { return student1; } //return student2's name back to Grades public String getStudentName2() { return student2; } //get all the marks from Grades, then caculate in here. public int inputGrades(int s1s1, int s1s2, int s2s1, int s2s2) { s1Score1 = s1s1; s1Score2 = s1s2; s2Score1 = s2s1; s2Score2 = s2s2; average1 = (double)((s1Score1 + s1Score2)/2); average2 = (double)((s2Score1 + s2Score2)/2); return 0; } //return average1 and average2. public double getAverage1(){ return average1; } public double getAverage2(){ return average2; } } ======================================= Grades.java ======================================= import java.util.Scanner; public class Grades { public static void main(String[] args) { String student1 = "Mary"; String student2 = "Mike"; Student X1 = new Student (student1, student2); Scanner scanner = new Scanner (System.in); //Studnet1's marks. //s1Score1 = Student1's first test score. //s1Score2 = Student1's second test score. System.out.print("Please enter Test1 score for " + student1 ); System.out.println(" :"); int s1Score1 = scanner.nextInt(); System.out.print("Please enter Test2 score for " + student1 ); System.out.println(" :"); int s1Score2 = scanner.nextInt(); //Student2's marks. //s2Score1 = Student2's first test score. //s2Score2 = Student2's second test score. System.out.print("Please enter Test1 score for " + student2 ); System.out.println(" :"); int s2Score1 = scanner.nextInt(); System.out.print("Please enter Test2 score for " + student2 ); System.out.println(" :"); int s2Score2 = scanner.nextInt(); //send the marks to Studnet, then Student will caculate for it. X1.inputGrades(s1Score1, s1Score2, s2Score1, s2Score2); //print out the final reslut, finished. System.out.println("The average for "+ X1.getStudentName1() + " is " + X1.getAverage1()); System.out.println(); System.out.println("The average for "+ X1.getStudentName2() + " is " + X1.getAverage2() ); System.out.println("Done"); } } ======================================= Ticket.java ======================================= import java.util.Scanner; public class Ticket { String firstName, lastName = ""; String depCity, depCountry, depPoint = ""; String arvCity, arvCountry, arvPoint = ""; String fullForm, compactForm = ""; public Ticket (String fn, String ln) { firstName = fn; lastName = ln; } public String getFirstName() { return firstName; } public String getLastName() { return lastName; } public String setDeparturePoint (String dCity, String dCountry) { depCity = dCity; depCountry = dCountry; depPoint = (String)(dCity + " (" + dCountry + ")"); return null; } public String setArrivalPoint(String aCity, String aCountry) { arvCity = aCity; arvCountry = aCountry; arvPoint = (String)(aCity + " (" + aCountry + ")"); return null; } public String printFullForm() { fullForm = (String)(firstName + " " + lastName + ": " + depPoint + "-" +arvPoint); return fullForm; } public String printCompactForm() { compactForm = (String)(firstName.substring(0,1).toUpperCase() + "." + lastName + ": " + depCity + " (" + depCountry.substring(0,2).toUpperCase() + ") - " + arvCity + " (" + arvCountry.substring(0,2).toUpperCase() + ")"); return compactForm; } } ================================================= TicketTest.java ================================================= import java.util.Scanner; public class TicketTest { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.println("Please enter the First Name: "); String firstName = in.nextLine(); System.out.println("Please enter the Last Name: "); String lasttName = in.nextLine(); Ticket N1 = new Ticket (firstName, lasttName); System.out.println("Please enter the names of departure city: "); String depCity = in.nextLine(); System.out.println("Please enter the names of departure country: "); String depCountry = in.nextLine(); System.out.println("Please enter the names of arrival city: "); String arvCity = in.nextLine(); System.out.println("Please enter the names of arrival country: "); String arvCountry = in.nextLine(); N1.setDeparturePoint(depCity, depCountry); N1.setArrivalPoint(arvCity, arvCountry); System.out.println ("Full Form ..."); System.out.println (N1.printFullForm()); System.out.println ("Comapct Form ..."); System.out.println (N1.printCompactForm()); System.out.println ("DONE"); } }