"a menu must be provided that asks the user of the software what task they would like to perform; it then activates the required task. The menu should loop until the user requests to exit"- that is the requirement. And i haven't learn about switch-case. So how can i create my menu? thanks

because i haven't study about switch-case and break. So i think i cant use those in my assignment :(

OK. You don't need to use a switch, you can do the same thing with a lot of if tests. Similarly, you don't need break, you can use a while loop to keep looping as long as the input is not "exit".

so i can do same thing like the link u gave above? without the switch and the break??

yes, it goes like this (pseudo code)

input = ""
while (input is not "exit")
   prompt user with menu choices
   get user input
   if (input is abc) do task abc
   else if (input is def) do task def
   (etc)

thank you very much :)

Or see it as a good reason to start reading about switch statements :)
Never be afraid to experiment and learn something new.

can i ask one more problem? "Add a customer:Customers can be added to the system up to a maximum of 200. When a customer is added, the user enters all customer information such as the customers name, email etc. The customer ID’s are allocated from 1 up to 200, customer 1 is added first, then customer 2 and so on."-that is the requirement.
And this is my lines of code:

    public void addCustomer(Customer newCustomer)
    {
        if(numberOfCustomer < customer.length)
        {
            customer[numberOfCustomer] = newCustomer;
            numberOfCustomer++;
        }
    }

will it work??

might work, but since we don't see all your code, we can only speculate.
just to add a little insight here: if you can add customers, it sounds like you can also remove them (or might be required to do so later on).

that way, just adding it as a next won't always do.

for instance: you add 3 Customers "John, Burt, Thomas"

then, you remove Burt, so , you'll end up with:
"John", null, "Burt"

when you add a next one, you should add him in the first possible place (the first place that is null).
only if you iterate over the entire array and it contains no null values, you should say it is full.

EDIT: either that, or when implementing a remove method, you can make it clean up the null values by moving the next elements to index - 1 , and subtract 1 from your 'numberOfCustomer' variable

in order to get more flexibility to delete and remove customers without being worried about the container size, i strongly suggest you to use Vector<Customer> Customers, and you can just add them doing add(customer)...

that way you won't get null spaces after deleting customers...

good luck

no, don't use Vector. Vector was made redundant over a decade ago and would have been marked as @deprecated had it not been in such widespread use already at the time in Swing and AWT.

Use a List or Set instead.

Member Avatar for iamthwee

Yes you might be tempted to use vector if you come from a c++ background, java use the above instead.

thanks guys. this will help a lot :)

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.