-
Arrays Help!
Hello everyone,
My problem is I need to let the user enter the dimensions of the array at runtime and use loops to fill the array with random number from 50 to 150. I must the random() method.
Someone please help, I am a beginner! This is what I have so far.
import java.util.Random;
public class ArrayTA
{
public static void main(String [] args)
{
Random random = new Random();
System.out.print("Enter the length of the row: ");
int x = SavitchIn.readLineInt();
System.out.print("Enter the length of the row: ");
int y = SavitchIn.readLineInt();
double [][]myDoubles;
myDoubles = new double [x][y];
for(int i = 0; i<myDoubles.length; i++){
for(int j = 0; j<myDoubles.length; j++){
myDoubles[i][j] = SavitchIn.readLineDouble();}
System.out.println(myDoubles[i]);
}
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks