emergency! need help for my assignment


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 1 of 1

Thread: emergency! need help for my assignment

Hybrid View

  1. #1
    Join Date
    Apr 2006
    Posts
    1

    Exclamation emergency! need help- passing array.

    i'm 1st year student at uni... never done programming before... so...
    i'm using BlueJ as my environment

    in my assingment, i'm suppose to create a PDA- Memos.
    the program had to be able to add and show memos. and it has to be able to add up to 3 max memos.

    i'm up to the bit where i have to show the memos. i try to crate a empty array then some how pass the string in menu(), which was returned by addMemo(), to the array in showMemo(). but i'm not sure if this is the right way. some of the problems i think i have are highlighted with colours, can you help me please?
    ps. if there is anymore wrong coded codes please correct me.
    thank-you


    Code:
     
     public class PDA
      {
    	   public void main()
           {
               System.out.println("Welcome to your PDA!");
               menu();
           }
        
           private void menu()
           {
               int menu = 0;
               String memo = "";
               String [] arrayMemo = new String [3];
               
                  while (menu != 3)
                  {
                      System.out.println("\t" + "Memos" + "\n" + "1. Add Memos" + "\n" + "2. Show Memos" + "\n" + "3. Close");
                      System.out.println("Please entre your choice:");
                   
                      menu = Console.readInteger();
                
                      if (menu == 1)
                               memo = addMemo();
                      else
                        if (menu == 2)
                               showMemo(arrayMemo[memo],memoCount);
    // i got a error message - incompatible type- found java.lang,String but expected int
                        else
                          if (menu != 3)
                               System.out.println("Invalid Choice- try again");
                  } 
                  
                  
           }
            
           public String addMemo()
           {
               String memo = "";
    
               int priority = inputPriority();  
               String category = inputCategory();
               String subject = inputSubject();
               String description = inputDescription();
               String date = getDate();
               
               memo = "Date: " + date + "\t" + "Priority: " + priority + "\t" + "Category: " + category + "\n" + "Subject: " + subject + "\n" + "Description: " + description; 
               // display add memo
               
               return memo;           
           }
               
           private void showMemo(String[] arrayMemo, int memoCount)  //i don't know what this is can u tell me?
           {
                int menoCount = 0; //do i have to initialise it?
               
               for (int index = 0; index < arrayMemo.length(); index++)
               {
                  System.out.println(arrayMemo[index]);
               }
               
           }
           
     }
    Last edited by jjsmyy24; 04-07-2006 at 07:28 PM. Reason: some code wasn't part of the problem

Similar Threads

  1. Replies: 3
    Last Post: 10-31-2006, 04:51 PM
  2. assignment operator
    By rssmps in forum C++
    Replies: 5
    Last Post: 12-19-2005, 05:10 AM
  3. Replies: 3
    Last Post: 10-21-2005, 10:06 AM
  4. Replies: 2
    Last Post: 07-02-2005, 12:35 PM
  5. help regarding java assignment
    By abbas in forum Java
    Replies: 0
    Last Post: 12-12-2001, 09:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center