Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Help required in designing a Java application

Posted on 2012-04-12
5
Medium Priority
?
620 Views
Last Modified: 2012-08-13
I am seeking the help for the best Java design that I should use for a particular scenario described below.

1) A button press generates a String Array that contains 'n' strings.

2) I need to check whether this 'Generated Array' contains a pre-defined string(out of 'n' pre-defined strings).

3) If the 'Generated Array' contains any of the pre-defined strings, I need to take an action.

What is the best way of designing this application/ How should I model the classes?

Following is the raw thought I have

1) Main class which handles the Array Generation on Button press
2) A dedicated class for pre-defined strings in which I define 10, 100 , 1000 or more pre-defined strings alone?
3) A dedicated class to handle the actions, if match occurs between 'Generated Array' strings and pre-defined string?

Is this the correct model? Are there any other better design than this?


Best suggestions and guiding is much appreciated
0
Comment
Question by:Sreejith22
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 41

Expert Comment

by:HonorGod
ID: 37844389
When you say "a button press", that implies a graphical user interface (GUI).
Did you really mean that?

If so, which GUI framework will you be using?  Swing?

How familiar are you with event driven application development?
0
 
LVL 20

Assisted Solution

by:gatorvip
gatorvip earned 351 total points
ID: 37844412
>>A button press generates a String Array that contains 'n' strings.

I don't understand this part - you create random strings? Otherwise this reads like a simple array declaration to me.
i.e., String[] arr = new String[n];

>>2) I need to check whether this 'Generated Array' contains a pre-defined string(out of 'n' pre-defined strings).

How do you populate your array, where are the string values coming from?
0
 
LVL 37

Assisted Solution

by:zzynx
zzynx earned 348 total points
ID: 37844910
>> 1) Main class which handles the Array Generation on Button press
Agree. And that also triggers the action to be taken in case of a match [3)]

>> 2) A dedicated class for pre-defined strings in which I define 10, 100 , 1000 or more pre-defined strings alone?
Agree. And that also contains a method that takes an array of strings as a parameter and returns a boolean telling you if the passed Array contains any of the pre-defined strings.

>> 3) A dedicated class to handle the actions, if match occurs between 'Generated Array' strings and pre-defined string?
Can be a dedicated class. But can also be a method defined in your main class. Depending on how complex the action to be taken is
0
 
LVL 9

Accepted Solution

by:
Manikandan Thiagarajan earned 351 total points
ID: 37896981
Use Abstract class and Interface

Abstract class you define the method and generate Array Using Interfact Reference you get the arrat

Use Swing Button When Action Perform method you would call the Interface and abstract class

Or JSP UseBean you callt the abstract class or Intrface
0
 
LVL 37

Expert Comment

by:zzynx
ID: 37918081
Thanx 4 axxepting
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues undeā€¦
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question