This week's book giveaway is in the Java in General forum.We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General forum!

# Duc Nguy

Greenhorn
since Nov 12, 2001
Cows and Likes
Cows
0
In last 30 days
0
Total given
0
Likes
0
0
Total given
0
Given in last 30 days
0
Scavenger Hunt
Ranch Hand Scavenger Hunt
Greenhorn Scavenger Hunt

## Recent posts by Duc Nguy

Can someone please explain what these methods do and an eample of how to use or set it up.
17 years ago
I created a java program that deals with array but i got stuck on sorting the number in the array and getting the median from the sort can some help me out on this one.
import sort;

public class Random
{
public static void main (String[] args)
{
double total = 0;
double average = 0;
double[] number = new double[25];
for(int i = 0; i < 25; i++)
{
number[i] = (Math.random()*100+1);
total +=number[i];
}
average = total/25;
System.out.println("Average number in array: " + average);
{
Sorts.selectionSort (number[i]);
for (int index = 0; index < grades.length; index++)
System.out.println (number[i] + " ");
}
}
}

17 years ago
What should i put if i want a return?
17 years ago
it keep asking for return type. What should i put in here to get it to stop the eroor
public static goForward(Drivable sedan)
{
sedan.accelerate();
sedan.decelerate();
}
public static turn(Drivable sedan, int direction)
{
sedan.decelerate();
sedan.turn(direction);
sedan.accelerate();
17 years ago
How do i get this to work with Van, sedan class
public class TestDrivable
{
public static final int LEFT = 0;
public static final int RIGHT = 1;
public static goForward(Drivable vechicle)
{
vechicle.accelerate();
vehicle.decelearate();
}
public static turn(Drivable vehicle, int direction)
{
vehicle.decelerate();
vehicle.turn(direction);
vehicle.accelerate();
}
public static void main(String [] args)
{
Van mini = new Van;

17 years ago
I have to use a helper functions in the driver class with main to help with the driving. The paterrn for the Test drive is the following.
public class TestDrivable
{
public static final int LEFT = 0;
public static final int RIGHT = 1;
public static goForward(Drivable vechicle)
{
vechicle.accelerate();
vehicle.decelearate();
}
public static turn(Drivable vehicle, int direction)
{
vehicle.decelerate();
vehicle.turn(direction);
vehicle.accelerate();
}
public static void main(String [] args)
{
Van mini = new Van;

I have no idea what this mean can you help me clarify on what i should do to make this whole thing work
17 years ago
I have to develop number of vehicle types using the following interface. How do i use them
public interface Driveable
{
public static final int LEFT = 0;
public static final int RIGHT = 1;
public void start();
public void stop();
public void accelerate();
public void decelrate();
public void turn (int direction);
}