 |
|
 |
i am a IT student,i need help for my case study because its is so difficult!!!
My case study is quick Sort!!!
plss send in my email!!
|
|
|
|
 |
|
 |
Hello, i'm new and also beginner in java. I tried to make sort in java (JCPro) but i don't know how. Can anyone tell me? The sort run in windows mode not DOS-MODE. There is also 4 option to choose :
1.insertion
2.sequential
3.bubble
4.quick
So you can choose what kind of sort you like.you can input the number you want to sort in a textarea and how much the number is.Example :
How many number you want to sort : 5
Number 1:5
Numver 2:9
Number 3:4
Number 4:3
Number 5:6
And you can see the sort run in animation.
example: there is 5 box with 5 number that you input and the box is moving and change its colour.
Please help me with this. Thanks.
You can see the example in www.cs.oswego.edu/~mohammad/classes/csc241/samples/sort/Sort2-E.html[^].
But this only works if your IE or Mozilla supported with Java.
How can i make it like that but ina simple code? Because all that i have found is already intermediate.
|
|
|
|
 |
|
 |
I have a vector of vectors:
Vector vecRow = new Vector();
Vector vecCol = new Vector();
vecRow.add(aa);
vecRow.add(bb);
vecCol.add(VecRow);
this is the structure like a 2D matrix.
I need to sort by first colum ??
kakofoniks
|
|
|
|
 |
|
 |
import java.util.Comparator;
import java.util.List;
/**
* A comparator to sort Lists of data based on a column within each List
*/
public class ListComparator implements Comparator
{
private int column;
private boolean ascending;
ListComparator(int column, boolean ascending)
{
this.column = column;
this.ascending = ascending;
}
public int compare(Object a, Object b)
{
List v1 = (List)a;
List v2 = (List)b;
Object o1 = v1.get(column);
Object o2 = v2.get(column);
// Treat empty strings like nulls
if (o1 instanceof String && ((String)o1).length() == 0)
{
o1 = null;
}
if (o2 instanceof String && ((String)o2).length() == 0)
{
o2 = null;
}
// Sort nulls so they appear last, regardless of sort order
if (o1 == null && o2 == null) return 0;
if (o1 == null) return 1;
if (o2 == null) return -1;
// Compare objects
if (o1 instanceof Comparable)
{
if (ascending)
{
return ((Comparable)o1).compareTo(o2);
}
else
{
return ((Comparable)o2).compareTo(o1);
}
}
else // Compare as a String
{
if (ascending)
{
return o1.toString().compareTo(o2.toString());
}
else
{
return o2.toString().compareTo(o1.toString());
}
}
}
}
|
|
|
|
 |
|
 |
Hi, need help on sorting 2D arrays...
eg. have a String array of 7 full names and want to sort by lastname, how to tackle this in java programming?
i tried to use the for loop on the lastname column but the problem is the firstnames are not follows their lastnames after sorting in this way...
any help is much appreciated.
oh by the way, am jus a beginner in java programming.
regards
|
|
|
|
 |
|
 |
i need to:
1. read thru a ord document, looking for numbers, and store those numbers in an array
2. do this for numerous documents
3. compare the arrays from each document
|
|
|
|
 |
|
 |
Anonymous wrote:
i need to:
1. read thru a ord document, looking for numbers, and store those numbers in an array
2. do this for numerous documents
3. compare the arrays from each document
Then what are you waiting for? Start working, man.
|
|
|
|
 |
|
 |
is anybody can help me i n doing Merge Sort in an array
|
|
|
|
 |
|
 |
JDBC
Contents
problem statement
database specification
description of java program
imputant information submiiting your file
problem statement
writing a java program to connect to an oracle database using JDBC.
database specificaton
the following schema describe some tables owned by user oodm in the database on logic:
oodm.staff(snum, name, dob address,city , gender, salary, supervisor, dnum)
oodm.dept(dnum, dname, manager, mgrstartdate)
oodm.deptlocation(dnum, dcity)
oodm.project(pnum, pname, pcity, dnum)
oodm.workson(snum, pnum, hours)
descriptions of the columns in each table follow. infomation about foreign keys in the tables is shown below.
table column description
oodm.staff snum staff number
name staff member's name
dob staff member's data of birth
address staff member's address
city city where staff member lives
gender either f(female) OR m(male)
salary staff member's salary
supervisor snum of staff member's supervisor
dnum dnum of staff member's department
oodm.dept dnum identifying number for department
dname name of department
manager snum of department's manager
mgrstartdate date when manager was appointed
oodm.deptlocation dnum dnum of department
dcity city where the department is located
oodm.project pnum identifying number for project
pname project name
pcity city where the project is located
dnum dnum of department that controls the project
oodm.workson snum snum of staff member
pnum pnum of a project that a staff member works on
hours hours per week that staff member works on project
note that a department can be located in more than one city, but a project is located in only one city.
table foreign key referenced table
oodm.staff supervisor oodm.staff
oodm.staff dnum oodm.dept
oodm.dept manager oodm.staff
oodm.deptlocation dnum oodm.dept
oodm.project dnum oodm.dept
oodm.workson snum oodm.staff
oodm.workson pnum oodm.project
description of java program
write a java program that will do the following:
1.print the following declaration(replacing the name shown in the example with your name, of course).
2. prompt the user for a username and password to log on to the school of CIS'S Oracle database named stud.
3.prompt the user to enter the Pnum of a project.
4.print the name and city of that project.
5.print the name and the number of hours worked per week for every staff member working on that project.
6.calculate and print the total hours worked per week for all staff members working on that project.
your user interface should look something like this (user responses shown in bold face note that you should use your own username and password in place of the example shown):
enter oracle username: cisspr
enter oracle password: the84pass
enter project number: p005
project name: adelaide festival
project city: adelaide
ATZENI, John 8
McBRIDE, David 16
CERI, Rose 16
Total hours 40
End of SQL
Implement a program which can perform the following actions:
Prompt the user for input file name, read the file and determine the number of alphanumeric characters, the number of words, the number of sentences in the file. To determine the number of sentences the number of periods (dots) should be counted (newlines and tabs should be disregarded). Allow the user to press any keys to return back to the main menu.
Prompt the user for the input and output file names, append the contents of on
|
|
|
|
 |
|
 |
Hello
I have a question for you:
As you know if we pass an object as an argument to a function it will be by reference. But passing simple types like float or double will be 'by value'. Is it possible to simulate the following C++ instruction in Java:
for e.g. void MyFunction( float& a , int& b )
So that the modified values of a and b are returned as process result?
Thank you.
|
|
|
|
 |
|
 |
Yes. In Java, you can use array parameter to "simulate" reference parameter. Here is an example. The test program will print "2" as output.
Good luck.
class RefTest
{
void test(int[] pInt)
{
pInt[0] = 2;
}
public static void main(String[] args)
{
int pInt[] = new int[1];
pInt[0] = 1;
RefTest obj = new RefTest();
obj.test(pInt);
System.out.println(pInt[0]);
}
}
|
|
|
|
 |
|
|
 |
|
 |
but what if the valus is quiet diferent from that u passed
c it is a serious problem
Jitu
|
|
|
|
 |
|
 |
cool, this helped me out too. thanks!
|
|
|
|
 |
|
 |
Hi All,
For those who are interested in P2P, Web Services, distributed network computing, there is an alternative pure Java based Distributed Network Computing platform. The software is downloadable at www.GreenTeaTech.com.
Chris
|
|
|
|
 |
|
 |
I want to sort an ArrayList or Vector containing Vector of Vectors.
Eg: I have a ARRAYLIST containg ArrayList(ArrayList) objects which needs to be sorted based on the COLUMN that I select from my UI screen.
|
|
|
|
 |
|
 |
Define a comparator for each Column
and use the Arrays.Sort(Obj , ComparatorColName())
|
|
|
|
 |
|
|
 |
|
 |
Here is how I get quartiles in JBuilder:
ArrayList ray = new ArrayList(numofrecs);
myprog.Frame1.myrow.first();
rg = 0;
while (myprog.Frame1.myrow.inBounds())
{
try {
adouble = myprog.Frame1.myrow.getDouble(acolumnnum);
ray.add(rg,new Double(adouble);
rg++;
}
catch (DataSetException dse) {
}
myprog.Frame1.myrow.next();
}
java.util.List rine = Collections.synchronizedList(ray);
Collections.sort(rine);
cQ1 = ((Double)rine.get(( irecs) / 4)).doubleValue();
cQ3 = ((Double)rine.get((3 * irecs) / 4)).doubleValue();
|
|
|
|
 |
|
|
 |
 | ok.  |  | Anonymous | 19:13 25 Jul '01 |
|
|
 |