473,563 Members | 2,556 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

array sortieren

hallo,
ich hoffe es kann mir jemand von euch helfen. ich hab noch ziemlich
grosse probleme mit java;(. sicherlich,soll te ich versuchen,das
alleine hin zu bekommen,aber im moment weiß ich noch gar nicht wie ich
da am besten anfange.
ich hoffe jemand nimmt sich die zeit und hilft mir damit.bitte so
schnell wie möglich
ich hab folgende aufgaben:
1.
a)
jeweils ein integer,double und ein string array anlegen (bsp.:
Double[] arrayofdoubles = new Double[20];
b)
EINE Klassenmethode impl.,die jedes array jeweils mit zufallszahlen
belegt (random benutzen)
Methodenkopf: public static void fill_with_rando m(Object[]
array_of_object s){
/*some java code*/
}

instanceof benutzen um korrekte strategie zum wertebelegen nutzen zu
können
c)
EINE klasenmethode,d ie ein per argumetn übergebenes array in
absteigender reihenfolge sortiert
Bsp:
public static void bubblesort(OBje ct[] array_to_sort){
/*some java code*/
if (array_to_sort[i] instanceof Integer){
/*Integer specific sort code*/
}
if(array_to_sor t[i] instanceof String){
/*String specific sort code*/
}
}
d)
array auf konsole ausgeben:
public staic void print_on_konsol e(Object[] array_to_sort,
int index_from, int inex_to){
/*some java code*/
}
2.
array variabler grösse,wenn die arraygrenzen überschritten werden,dann
soll das array dynamisch an die jeweils passende grösse angeglichen
werden
a)
einfache array basisklasse implementieren
b)
zugriffsfunktio nen wie folgt deklarieren:
public void put_at (int index, int value){
try{
/*some java code*/
} catch (ArrayIndexOutO fBoundsExceptio n e){
/*some java code*/
}
}
c)
lesezugriff

public int get_at(int index){
try{
/*some java code*/
} catch(ArrayOutO fBoundsExceptio n e){
/*some java code*/
}
}
Jul 17 '05 #1
0 6834

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2768
by: Brian | last post by:
I'm diddlying with a script, and found some behavior I don't understand. Take this snippet: for ($i = 0; $i <= count($m); $i++) { array_shift($m); reset($m); }
2
575
by: Stormkid | last post by:
Hi Group I'm trying to figure out a way that I can take two (two dimensional) arrays and avShed and shed, and subtract the matching elements in shed from avShed I've pasted the arrays blow from a print_r cmd any suggestions would be great. Thanks much Todd //avShed array Array ( => Array ( => 1 => 08:00 ) => Array ( => 1 => 08:05 ) ...
15
5163
by: lawrence | last post by:
I wanted to test xml_parse_into_struct() so I took the example off of www.php.net and put this code up on a site: <?php $simple = <<<END <item>
8
3465
by: vcardillo | last post by:
Hello all, Okay, I am having some troubles. What I am doing here is dealing with an employee hierarchy that is stored in an array. It looks like this: $employees = array( "user_id" => array( "name", "title", "reports to user id", "start date in the format: mm/dd/yyyy" ) ); How can I display this hierarchy in simple nested <li> tags in...
12
55536
by: Sam Collett | last post by:
How do I remove an item with a specified value from an array? i.e. array values 1,2,2,5,7,12,15,21 remove 2 from array would return 1,5,7,12,15,21 (12 and 21 are NOT removed, duplicates are also removed) So far I have (val is value, ar is array, returns new array):
8
10206
by: Mike S. Nowostawsky | last post by:
I tried using the "toUpperCase()" property to change the value of an array entity to uppercase BUT it tells me that the property is invalid. It seems that an array is not considered an object when it is assigned a text literal?? HOW can I change the array value to upper case then? What other method exists for arrays? Ex: var GridArrayName1...
58
10077
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of code... TCHAR myArray; DoStuff(myArray);
35
6607
by: VK | last post by:
Whatever you wanted to know about it but always were affraid to ask. <http://www.geocities.com/schools_ring/ArrayAndHash.html>
11
39436
by: deko | last post by:
I need to create a basic one-dimensional array of strings, but I don't know how many strings I'm going to have until the code is finished looping. pseudo code: Dim astrMyArray() Do While Not rst.EOF i = i + 1 If rst!Something = Then astrMyArray(i) = rst!Something
0
7658
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7631
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6238
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5204
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3631
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3615
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1194
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
912
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.