Results 1 to 6 of 6
Thread: wont run with main
- 05-05-2011, 04:08 AM #1
Member
- Join Date
- Apr 2011
- Posts
- 11
- Rep Power
- 0
wont run with main
Hi,
Im really new to java and i need to make methods for this menu.
But before i start i want to get the "menu" to come up when i click run in netbeans.
Ive added a main class, and it says its built successfully but it doesnt prompt any output
can anyone help me with this? I am totally confused?:confused:
Ive attached the code below:confused:
package students;
public class Main {
public static void main(String[] args){
}
private final static String[] mainMenuOpts = {"Students","Lecturers","Admin","Exit"};
private final static String[] studentMenuOpts = {"Add Student","List all Students","Find a Student","Return to Main Menu"};
private Menu mainMenu = new Menu("MAIN MENU",mainMenuOpts);
private Menu studentMenu = new Menu("STUDENT MENU",studentMenuOpts);
private DataStore data = new DataStore();
private java.io.PrintStream out = System.out;
private ReadKb reader = new ReadKb();
/** Creates a new instance of Main */
public Main() {
run();
}
private void run(){
int ret = mainMenu.display();
while(true){
switch(ret){
case 1: students();break;
case 2: lecturers(); break;
case 3: admin(); break;
case 4: exit(); break;
}
ret = mainMenu.display();
}
}
private void students(){
int ret = studentMenu.display();
while(ret != 4){
switch(ret){
case 1: addStudent();break;
case 2: listStudents(); break;
case 3: findStudent(); break;
}
ret = studentMenu.display();
}
}
private void lecturers(){
out.println("\nLecturers not yet implemented");
}
private void admin(){
out.println("\nAdmin not yet implemented");
}
//Student methods
private void addStudent(){
out.println("\n\tAdd New Student");
//prompt for details
//add student to the datastore
//ask if they want to enter another student -
// if so call addStudent again
//otherwise the method completes and the studentMenu will display again
}
private void listStudents(){
out.println("\n\tStudent Listing");
//list all students from the datastore
}
private void findStudent(){
out.println("\n\tFind Student");
out.print("Enter Search String: ");
//reasd search text
//use datastore method to get list of students that contain the search string
//display matching students
}
// end Student methods
private void exit() {
data.save(); //call the datastore method that will save to file
out.println("\n\nGoodbye :)");
System.exit(0);
}
}
- 05-05-2011, 04:13 AM #2
Go back to the basics.
Lesson: The "Hello World!" Application (The Java™ Tutorials > Getting Started)
db
- 05-05-2011, 04:16 AM #3
Senior Member
- Join Date
- Mar 2011
- Posts
- 261
- Rep Power
- 3
Oh boy... Darryl is right.
- 05-05-2011, 04:20 AM #4
Member
- Join Date
- Apr 2011
- Posts
- 11
- Rep Power
- 0
Okay,
I didn't write this code (might be obvious) my task is to get it running if no one can "humor" me with a little mentoring . then please don't respond
no disrespect intended
thanks
- 05-05-2011, 06:22 AM #5
Why should anyone repeat here something that's clear from the tutorial linked?
Also, you need to recognize that when posting on a public forum, you have no control over who responds and how.
db
- 05-05-2011, 07:08 AM #6
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Similar Threads
-
Making an object of main and running a thread in main
By Grimmjow in forum New To JavaReplies: 1Last Post: 01-23-2011, 05:19 PM -
SQLite database wont create during web app running but will when run as main
By teckygamer in forum JDBCReplies: 12Last Post: 08-26-2010, 10:14 AM -
Exception in thread "main" java.lang.NullPointerException at LinkedList.main(Link
By kavitha_0821 in forum New To JavaReplies: 6Last Post: 07-16-2009, 03:30 PM -
[SOLVED] Why main() in java is declared as public static void main?
By piyu.sha in forum New To JavaReplies: 5Last Post: 10-06-2008, 12:11 AM -
exception in thred main java.lang.nosuchmethoderror: main
By fernando in forum Java AppletsReplies: 1Last Post: 08-06-2007, 09:11 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks