Solved

manipulate value

Posted on 2004-03-31
7
190 Views
Last Modified: 2010-04-01
Yes I'm a newbie.. I have a parameter:
String docID = request.getHeader("docID");
This will be a 3 or 4 digit number.
Ithen want to take this number and :
1. reverse it (1234 becomes 4321)
2. get a random number between 1- 2
3. Add it to reversed number (4323)
4. multiple by 2 (8646)
5. get another random digits based on first random number (if first number was a 1 then I need one more random number, if the first random number was a 2 then I need two random numbers) for example if the first random number was a 2 then any value between 10 - 99 would be fine if the first random number was a 1 then any value between 0-9 would be acceptable.
6. Append first random number to front of existing number
7. append second random number(s) to end of existing number.

Examples:docID = 321
1. 123
2. random number 2
3. 1232
4. 2464
5. second random number 69 (2 digits because first random number was a 2)  
6.22464
7.2246469
0
Comment
Question by:894359
7 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 10730118
This sounds like homework...

We cannot do homework for you...what code do you have?

We can help you fix your own code...

Tim
0
 
LVL 6

Expert Comment

by:jarasa
ID: 10730394
You can start getting right the Parameter using:

Strind docID = request.getParameter("docID")

instead of

String docID = request.getHeader("docID");
 
The rest it shouldn't be hard to get with a Java Book, you have your steps well defined, if you know how to do it in other language just look for the commands in Java.

I don't think is good neither for you or us to do the job for you, it won't really help.

Javier
0
 

Author Comment

by:894359
ID: 10733495
It's not homework!
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 14

Expert Comment

by:kennethxu
ID: 10734190
>> It's not homework!
then what exactly help you need? are you expecting us the write the code for you?
0
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 10734232
the stuff you are asking avbove as nothing to do with Java/jsp!!!!!
all that cd have been in BASIC for that matter......... so it does sound like homwork..
anyways you post your initial code and will can try to correct it for you...
0
 

Author Comment

by:894359
ID: 10734549
I just thoght of this last night.. so i'm going to start writting code today (time permitting). I don't see how you can say it has nothing to do with Java or JSP. No this is not homework. I'm working on finding a solution for a problem at work and this will be part of my solution. As I said I'm new to JAVA. I have done limited JSP. The problem is I don't know what to look up when I'm looking at solving a particular step. I know what I want to do I just don't know what the methods etc. are called in JAVA.
0
 
LVL 19

Accepted Solution

by:
Kuldeepchaturvedi earned 500 total points
ID: 10734641
Alright here is a start for you..

String start = request.getParameter("docID");
start =reverseIt(start);
int docID=Interger.parseInt(start.trim());
int rand=new random().nextInt(3);// this might give a zero as a result back but we will worry abt that later
docID+=rand;
docID+=docID=docID*2;
if(rand==1)
//stringify the numbers and apppend them......

take it from here and I will see you after a meeting.....
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
java beans and EJBs 5 196
TreeSet comparator example 7 97
memory representation of int[][][] a=new int[2][][]; 10 60
Java Script nested call 3 87
The business world is becoming increasingly integrated with tech. It’s not just for a select few anymore — but what about if you have a small business? It may be easier than you think to integrate technology into your small business, and it’s likely…
The advancement in technology has been a great source of betterment and empowerment for the human race, Nevertheless, this is not to say that technology doesn’t have any problems. We are bombarded with constant distractions, whether as an overload o…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

856 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