Discussion:
core java coding.. pls help !
(too old to reply)
Riya
2014-05-14 18:07:26 UTC
Permalink
please help me to code in java..
my project is related to cloudsim, where i am also using core java to code.
Its mainly related to virtual machines(vm) and cloudlets/tasks, so each vm
will be given a set of cloudlet and it has to execute.Now i have to find
out how much each vm will cost if i assign particular amount to each one of
them.

I want to create two array which are 2 Dimensional.
1st array should contain "vm id"(1,2,3) and its "mips"(random values viz
50,100,150).
2nd array must have mips from 1st array and it should hold cost ( random
value say 500, 1000, 1500).

Thank you.
pls reply
Eric Sosman
2014-05-14 18:32:14 UTC
Permalink
Post by Riya
please help me to code in java..
my project is related to cloudsim, where i am also using core java to code.
Its mainly related to virtual machines(vm) and cloudlets/tasks, so each vm
will be given a set of cloudlet and it has to execute.Now i have to find
out how much each vm will cost if i assign particular amount to each one of
them.
I want to create two array which are 2 Dimensional.
1st array should contain "vm id"(1,2,3) and its "mips"(random values viz
50,100,150).
2nd array must have mips from 1st array and it should hold cost ( random
value say 500, 1000, 1500).
It sounds like your instructor is an old-line FORTRAN programmer:
Who else would use two-dimensional arrays for this sort of thing? But,
okay, "A Real Programmer can write FORTRAN in any language," so:

int[][] array1 = { {1, 50}, {2, 100}, {3, 150}, };
int[][] array2 = { {1, 500}, {2, 1000}, {3, 1500}, };
--
Eric Sosman
***@comcast-dot-net.invalid
rossum
2014-05-15 15:44:09 UTC
Permalink
On Wed, 14 May 2014 14:32:14 -0400, Eric Sosman
Post by Eric Sosman
Post by Riya
please help me to code in java..
my project is related to cloudsim, where i am also using core java to code.
Its mainly related to virtual machines(vm) and cloudlets/tasks, so each vm
will be given a set of cloudlet and it has to execute.Now i have to find
out how much each vm will cost if i assign particular amount to each one of
them.
I want to create two array which are 2 Dimensional.
1st array should contain "vm id"(1,2,3) and its "mips"(random values viz
50,100,150).
2nd array must have mips from 1st array and it should hold cost ( random
value say 500, 1000, 1500).
Who else would use two-dimensional arrays for this sort of thing? But,
int[][] array1 = { {1, 50}, {2, 100}, {3, 150}, };
int[][] array2 = { {1, 500}, {2, 1000}, {3, 1500}, };
Nah... *Real* FORTRAN uses the FORTRAN naming conventions:

int[][] ia1 = { {1, 50}, {2, 100}, {3, 150}, };
int[][] ia2 = { {1, 500}, {2, 1000}, {3, 1500}, };

All integer variables start with the letters i .. n. Short
meaningless names are real FORTRAN as well.

rossum (who prefers Algol to FORTRAN)
Roedy Green
2014-06-22 17:46:57 UTC
Permalink
Post by Riya
I want to create two array which are 2 Dimensional.
see http://mindprod.com/jgloss/array.html
for the basics

Java multidimensional arrays are quite different from other languages.
Don't expect them to behave anything like what you are used to.
--
Roedy Green Canadian Mind Products http://mindprod.com
Why program by hand in 5 days what you can spend
2 to 5 years of your life automating.
~ Terence Parr 1964-08-17
Loading...