So here the problem...
There are three bus services for each location.
Location 1: 95, 100, 14
Location 1: 20, 14, 144 where 20 95 100 and 14 are the bus number.
i have retrieved the bus services from mysql.
they are stored as String types
cbus1,cbus2,cbus3 (services for current location) and
dbus1, dbus2, dbus3 (services for destination).
I need to run through them get the services that are present in both the current location and destination.
I have initialized three variables common1, common2, common3 to 0.
I need to store the value of the common services in these three variables.
After they are stored I will use a very simple but long if else statement to combine them as a variable and send to the midlet.
Expand|Select|Wrap|Line Numbers
- if (common1==0&&common2==0 &&common3==0){
- String bussvc = "No Services available";
- }
- else if (common2==0 &&common3==0){
- String bussvc = Integer.toString(common1);
- }
- else if (common1==0 && common3==0){
- String bussvc = Integer.toString(common2);
- }
- else if (common1==0 && common2==0){
- String bussvc = Integer.toString(common3);
- }
- else if (common1==0 && common2==0){
- String bussvc = Integer.toString(common3);
- }
- else if (common3==0){
- String bussvc = ""+Integer.toString(common1)+"+","+"+Integer.toString(common1)+""
- }
- .
- .
- .
- .
- .