(i don\'t know how to use sort array and search array...) Purpose: Demonstrate t
ID: 3629251 • Letter: #
Question
(i don't know how to use sort array and search array...)
Purpose: Demonstrate the ability to create and execute a JAVA program that utilizes string manipulation to solve a daily life problem.
Assignment: Write a program that will accept ten (or more) names (first and last names) and associated birth-date. Your program should ask the user for how many people s/he wants to enter and then read the names (first and last) and the corresponding birth-date. The birth-date must be entered in the following format: MM/DD/YYYY. Your program should then use a menu that allows the user to display, search and exit. Display should display the list of the entries, sorted by last name, first name, or birth-date as requested by the user. Search should search for a specific entry by a specific field (last name, first name or birth-date) as requested by the user. Exit should terminate the program when the user selects exit from the menu
Explanation / Answer
import java.util.Scanner;
public class StudentTest
{
public static void main(String[] args)
{
int n;
String students;
Scanner input = new Scanner(System.in);
System.out.print("How many students?"); // STUCK HERE.. KNOW ITS NOT RIGHT
n = input.nextInt();
Student[] students = new Student[n];
for(int i = 0; i < n; i++)
{
System.out.println("Enter Student's fName");
String fName = input.nextLine();
System.out.println("enter last name:");
String lName = input.nextLine();
System.out.println("enter snumber");
String sNumber = input.nextLine();
students[i] = new Student("fName", "lName", "sNumber");
System.out.println(students[i]);
}
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.