Results 1 to 6 of 6
  1. #1
    minusten is offline Member
    Join Date
    Apr 2011
    Posts
    11
    Rep Power
    0

    Lightbulb 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);
    }
    }

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,184
    Rep Power
    19

  3. #3
    Solarsonic is offline Senior Member
    Join Date
    Mar 2011
    Posts
    261
    Rep Power
    4

    Default

    Oh boy... Darryl is right.

  4. #4
    minusten is offline Member
    Join Date
    Apr 2011
    Posts
    11
    Rep Power
    0

    Default

    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

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,184
    Rep Power
    19

    Default

    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

  6. #6
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    It "doesn't do anything" because that is exactly what you want it to do:

    Java Code:
    public static void main(String[] args){
    
    
    }
    Edit: As already said, read the tutorial, this would have been painfully obvious if you had.

Similar Threads

  1. Replies: 1
    Last Post: 01-23-2011, 05:19 PM
  2. Replies: 12
    Last Post: 08-26-2010, 10:14 AM
  3. Replies: 6
    Last Post: 07-16-2009, 03:30 PM
  4. Replies: 5
    Last Post: 10-06-2008, 12:11 AM
  5. Replies: 1
    Last Post: 08-06-2007, 09:11 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •