ill start out by apologizing for the code below being messy, i have spent the last week working on it but i keep backing myself into a corner. full disclosure, this is a homework assignment and if possible, i am looking for guidance as to how i can finish this and make it runable. I have tried everything i know at this point to no avail, my last idea was to split the random number generator from the rest of the program hence why it is split. thank you for your time and i look forward to hearing from you. i have put all of the code i have been able to come up with so far, and will attach the original assignment so that you can understand what i am trying to accomplish.
import java.util.Random;
public class SkyDiving
{
public static void main(String[] args)
{
Random myMoves = new Random();
int moveNumber = 0;
int pointValue = 0;
int j = 0;
for (int i = 0; i <= 10; i++)
{
for (j = 0; j < 5;)
{
moveNumber = RandomNumbers.getValue();
if (moveNumber <= 22)
{
pointValue = 2;
} else
{
pointValue = 1;
}
j += pointValue;
if (j > 6)
continue;
}
System.out.print("\n\n");
}
}
}
AND
import java.util.Random;
public class RandomNumber
{
public static int number;
public int getValue()
{
Random RandomNumbers = new Random();
for (int i = 1; i <= 1; i++)
{
number = RandomNumbers.nextInt(38)+ 1;
if (number == 1)
System.out.printf("(1)Snowflake\t");
if (number == 2)
System.out.printf("(2)Sidebody Donut\t");
if (number == 3)
System.out.printf("(3)Side Flake Opal Turt\t");
if (number == 4)
System.out.printf("(4)Monopod Monopod\t");
if (number == 5)
System.out.printf("(5)Opal Opal\t");
if (number == 6)
System.out.printf("(6)Stardian Stardian\t");
if (number == 7)
System.out.printf("(7)Sidebuddies\t");
if (number == 8)
System.out.printf("(8)Candian Tree\t");
if (number == 9)
System.out.printf("(9)Cats Accordian\t");
if (number == 10)
System.out.printf("(10)Dimond Bunyid\t");
if (number == 11)
System.out.printf("(11)Photon Photon\t");
if (number == 12)
System.out.printf("(12)Bundy\t");
if (number == 13)
System.out.printf("(13)Offset Spinner\t");
if (number == 14)
System.out.printf("(14)Bipole Bipole\t");
if (number == 15)
System.out.printf("(15)Catipilar\t");
if (number == 16)
System.out.printf("(16)Compressed Box\t");
if (number == 17)
System.out.printf("(17)DanishTree Murphy\t");
if (number == 18)
System.out.printf("(18)Zircon\t");
if (number == 19)
System.out.printf("(19)Ritz Icepick\t");
if (number == 20)
System.out.printf("(20)Piver Viper\t");
if (number == 21)
System.out.printf("(21)ZigZag Marguis\t");
if (number == 22)
System.out.printf("(22)Tee ChineseTree\t");
if (number == 23)
System.out.printf("(A)Unipod\t");
if (number == 24)
System.out.printf("(B)Stairstep Diamond\t");
if (number == 25)
System.out.printf("(C)MurphyFlake\t");
if (number == 26)
System.out.printf("(D)Yuan\t");
if (number == 27)
System.out.printf("(E)Meeker\t");
if (number == 28)
System.out.printf("(F)Open Accordian\t");
if (number == 29)
System.out.printf("(G)Cataccord\t");
if (number == 30)
System.out.printf("(H)Bow\t");
if (number == 31)
System.out.printf("(J)Donut\t");
if (number == 32)
System.out.printf("(K)Hook\t");
if (number == 33)
System.out.printf("(L)Adder\t");
if (number == 34)
System.out.printf("(M)Star\t");
if (number == 35)
System.out.printf("(N)Crank\t");
if (number == 36)
System.out.printf("(O)Satelite\t");
if (number == 37)
System.out.printf("(P)Sidebody\t");
if (number == 38)
System.out.printf("(Q)Phalanx\t");
}
return number;
}
}
Aucun commentaire:
Enregistrer un commentaire