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