Question
Java Programing Hey everyone, I am having two issues getting this code to opperate the way i would like it to. I will post the
Java Programing
Hey everyone, I am having two issues getting this code to opperate the way i would like it to. I will post the code in its entirety, followed by the previous assignment (current assignment is in picture) for those who would like to see it. and the current assignment is the image below, my issues are as follows:
1. how do i get the random number generatior to mark a selection as used, so that there are no duplicates in the competition (no repeated use of formations in the entire competition(by competitition i mean the 6 or ten rounds in A, AA and AAA))?
2. how do i limit it to one 6 point round per competition? a six point round can only appear once in a competition, and the only way a 6 point round could occur would be if it was made up of three numbered rounds (1-22), not other combination would be legal.
Im hoping someone can help me get the code below funtioning the was it needs to, I am at a loss, im not asking you to do the work for me (psuedo code or code snippits would be a life saver), but if you can, in your explanation could you at least show me what needs to be done (in code) so that i can make the proper edits and get this programming functioning the way it is supposed to. thank you for your time. the code below works, im just trying to get it working the way i need it to. thank you for your time
CODE:
import java.util.Random; import java.util.Scanner; import java.util.ArrayList;
public class Skydiving1 { public static void main(String[] args) { Random myRandom = new Random(); Scanner inputClass = new Scanner(System.in); ArrayList formationRound = new ArrayList();
int formation = 0; int point = 0; int jumpClass = 0; int roundNumber = 0; int round = 1; boolean pickedRandom = false; boolean A = false; boolean AA = false; boolean AAA = false; for( int i = 0; i
System.out.print( "1: Class A 2: Class AA 3: Class AAA "); System.out.print( " Enter number 1-3 depending on class: " ); jumpClass = inputClass.nextInt();
if( jumpClass == 1 ) { A = true; round = 6; formationRound.set( 1, true ); formationRound.set( 3, true ); formationRound.set( 5, true ); formationRound.set( 8, true ); formationRound.set( 10, true ); formationRound.set( 11, true ); formationRound.set( 12, true ); formationRound.set( 14, true ); formationRound.set( 16, true ); formationRound.set( 17, true ); formationRound.set( 18, true ); formationRound.set( 20, true ); formationRound.set( 22, true ); } else { System.out.print( "6 or 10 rounds? "); round = inputClass.nextInt(); if( jumpClass == 2 ) { AA = true; formationRound.set( 3, true ); formationRound.set( 5, true ); formationRound.set( 10, true ); formationRound.set( 12, true ); formationRound.set( 16, true ); formationRound.set( 17, true ); } else { AAA = true; } } for(int i=0; i
while(point 22) System.out.printf(" %s %s ",randomLetter(formation), formationName(formation)); else System.out.printf(" %d %s", formation, formationName(formation));
} System.out.println(); System.out.printf( " %s ", point ); } } public static String formationName(int g) { switch(g) { case 1: return "Snowflake Snowflake"; case 2: return "Sidebody Donut Sidebody Donut"; case 3: return "Side Flake Opal Turt"; case 4: return "Monopod Monopod"; case 5: return "Opal Opal"; case 6: return "Stardian Stardian"; case 7: return "Sidebuddies sidebuddies"; case 8: return "CandianTree CandianTree"; case 9: return "CatsAccordian CatsAccordian"; case 10: return "Dimond Bunyid"; case 11: return "Photon Photon"; case 12: return "Bundy Bundy"; case 13: return "Offset Spinner"; case 14: return "Bipole Bipole"; case 15: return "Catipilar Catipilar"; case 16: return "Compressed Box"; case 17: return "DanishTree Murphy"; case 18: return "Zircon Zircon"; case 19: return "Ritz Icepick"; case 20: return "Piver Viper"; case 21: return "ZigZag Marguis"; case 22: return "ZigZag Marguis"; case 23: return "Unipod"; case 24: return "Stairstep Diamond"; case 25: return "MurphyFlake"; case 26: return "Yuan"; case 27: return "Meeker"; case 28: return "Open Accordian"; case 29: return "Cataccord"; case 30: return "Bow"; case 31: return ""; case 32: return "Donut"; case 33: return "Hook"; case 34: return "Adder"; case 35: return "Star"; case 36: return "Crank"; case 37: return "Satelit"; case 38: return "Sidebody"; case 39: return "Phalanx"; default: return""; } } public static String randomLetter (int f) { if (f>22)
switch (f) { case 23: return "A"; case 24: return "B"; case 25: return "C"; case 26: return "D"; case 27: return "E"; case 28: return "F"; case 29: return "G"; case 30: return "H"; case 31: return "I"; case 32: return "J"; case 33: return "K"; case 34: return "L"; case 35: return "M"; case 36: return "N"; case 37: return "O"; case 38: return "P"; case 39: return ""; default: return ""; } return""; } }
PREVIOUS ASSIGNMENT:
A skydiving competition is comprised of the following: Each team has 5 members (4 point skydivers and a cameraman) Each meet has a maximum of 10 skydives Each skydive has a maximum of 5 maneuvers to perform in repetition in 35 seconds, but the number of maneuvers can vary. These maneuvers are taken from a dive pool comprised of the following: There are 16 Random formations labeled A-Q that are worth 1 point There are 22 block sequences labeled 1-22 that are worth 2 points A skydive is randomly generated with a maximum of 5 maneuvers per dive and with a minimum of three maneuvers. There are some combinations, however, that are illegal since the rules state that the only way to have a 6 point skydive is by using three blocks. This means, looking at the dive pools that at least 1 random must appear in any other round except this 6 point round. So a dive with all blocks has 6 points and all others have 5 points. A dive with all randoms is equally valid, however, and will be worth 5 points. Notice there is no formation labeled l (the letter). The issue is that you have to think about how you construct the skydives, as certain combinations may come up invalid during the selection process. In competition, each sequence you pick is repeated as many times as possible within 35 seconds from when your feet leave the airplane. There are 10 rounds in a full competition meet. ur program must: Generate the skydives for the meet using the above rules for a 10 round meet. Produce a listing of the dives by round. It can be formatted any way you want but it mu contain both the letter or the number corresponding to the formation, and the FULL NAME of the formation, Just make sure it is clearly printed on the screen
Formation Skydiving Leagues are regional, but belong to a National Organization known as the National Skydiving League. Each week during competition season, a draw, such as your last program ran, is produced and all teams jumping in the Leagues that weekend jump the same draw within the class that they belong to em 5 There are three classes in the league: A AA and AAA. The A class includes only the following blocks: 2 4 679 15 19 and 21. The AA Class includes only the following blocks: 1 2 4 6 7 89 11 dad 13 14 15 18 19 20 21 and 22. The AAA Class includes all IPC/USPA blocks. as pr Please amend your last program such that a correct draw can be produced for each of these classes. Your program should ask what class (s) the teams belong to, and you will need to produce a maximum of three different dra depending on what class teams you have. Only NV produce the appropriate draws If there are no Class A teams, only produce Class AA and AAA draws A meet consists of up to 10 competition rounds, but regular meets consist of a minimum od 6 rounds. Each of these rounds is scored by judges, and the meet raw score is the summation of the 6 rounds or the 10 rounds. Please amend the last program so that you can also specify the number orounds you would like produced either the full 10 round meet, or the shorter 6 round -meet. ease note that All Class A competitions re 6 rounds only. Note this also means that no formation may be repeated twice in any competition draw enor re Compun Thon
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started