Hello.

I am doing a project for a database that takes in student details and allows users to display their records.

My problem is this:
I have created a class called student (below coding) and created a menu class that displays the menu (2nd coding)
I seem to be stuck on the part of inputting information and using the menu class i want to display the information.

Can someone please help me out on this one?

package CW;
import java.io.*;

public class Student extends Person
{
	
		// atribute definitions
		
		private static int  studentNo;
		private int  yearOfstudy;
		
		Person Student[] = new Person[5];
		
		public Student(String fn,String ln,String add,String t,String dob, String phno,int sn,int ys)//constructor with two parameters student no,year of study
		{
			super(fn,ln,add,t,dob,phno);
			setStudentno(sn);
			setYearofStudy(ys);
			
		}
		
		
			
		
		//setter
		public void setStudentno( int sn)
		{
			studentNo= sn;
		}
		
		public void setYearofStudy(int ys)
		{
			yearOfstudy = ys;
		}
		
	
		//getter
		public int getStudentno()
		{
			return studentNo;
		}
		public int getYearofStudy()
		{
			return yearOfstudy;
		}
		
		public String tellaAoutself()
		{
			String detailsOfStudent =  getTitle()+  getFirstname()+  getLastname() + getDateofBirth()+ 
			getYearofStudy()+ getStudentno()+getPhoneno();
			
			return detailsOfStudent ;
		}
	
		public static void main(String[]args )
		{
			
			
			try
			
  			{
   
   				BufferedReader reader;
   				reader = new BufferedReader(new InputStreamReader(System.in));
   				String studentNo = reader.readLine(); //returns a String from the keyboard (when you press return)
   	 			String yearOfstudy = reader.readLine();
   	 			
   	 		
	 			
  			}
  			catch (IOException e){
  				
   			System.out.println(e);
  		}
  
  			
   
  		}
  
	 	
   	 	
	
		
		
}
package CW;
import java.io.*;
public class UniversityAdmin
{
	
	public static void main(String args[])
	throws IOException
	{
	
	//Allow a user to select operations using a text menu
		char mainMenu;
	
		
		do
		{
			System.out.println("\nWELCOME TO MIDDLESEX  UNIVERSITY DATABASE");
			System.out.println("\nPlease Make A Choice From The Menu Below");
			System.out.println(" Type 1. Display all Persons in the University");
			System.out.println(" Type 2. Display Student details");
			System.out.println(" Type 3. Display Lecturer details");
			System.out.println(" Type 4. Display all modules");
			System.out.println(" Type 5. Search for a Person by Surname");
			System.out.println(" Type 6. Dynamically add a new Student");
			System.out.println(" Type 7. Load from file");
			System.out.println(" Type 8  To end the program ");
			System.out.println(" Type Your Choice Here:");
		
		
			mainMenu=(char) System.in.read();
			
			
		}
		
		while (mainMenu<'1'||mainMenu>'8');
		System.out.println("\n");
		switch(mainMenu)
		{
			case '1':
			
			
			break; 	
		
			
		}
		
		
		
			
			
			
		
		
	}
}

i would apreciate ne help
Thx

Recommended Answers

All 4 Replies

You need to learn about file operations.

Here is a basic structure of what you need:

File f = new File("file.txt");
BufferedReader br = new BufferedReader(new FileReader(f));

String line = "";
while ( (line = br.readLine()) != null)
{
}

My bad, you were talking about databases. Then create a connection and then look through querying the database.

My bad, you were talking about databases. Then create a connection and then look through querying the database.

What do u mean by creating a connection, could you xplain abit more cuz i am new to this stuff...

If you're new then you need to do some research. Google JDBC.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.