I'm very new to Java since im only in my first semester of it in highschool but I am trying to create a program that can be used to score a competition.
The program will ask you how many schools are attending, then ask you the name of each school which will be stored in an array. Then it needs to ask you what each school will be participating in, there is a platoon category, color guard category, and squad category. They can aslo have more then one team in each category and can participate in any or all categories.
For example, Henderson County Highschool wants to participate in the squad and platoon categories, they will have 1 team for squad and 2 teams for platoon.
Anyway, after asking all that from the user, it will ask what score did each team from each school get and then it will calculate all the scores up and tell who the winners are in each category and a overall winner.
So far I have made the program ask how many schools are attending and then ask the names of the schools and store them but I'm having trouble with the teams.. How do i get each team to be assigned to a certain school when the school names are stored in a array? I hope you guys understand what I am trying to do here.. and this is my code so far
import java.util.Arrays; import java.util.Scanner; public class TextLab02st { public static void main(String args[]) { StartSchoolEntry.GetNumberOfSchools(); StartSchoolEntry.GetNamesOfSchools(); } } class StartSchoolEntry { static Scanner scanner = new Scanner(System.in); static int numberofschools; static String names[]; public static void GetNumberOfSchools() { System.out.print("How many schools are attending? "); numberofschools = scanner.nextInt(); System.out.println("Good, then there will be "+numberofschools+" schools attending."); System.out.println(" "); System.out.println(" "); System.out.println("#############################################"); System.out.println(" "); System.out.println(" "); } public static void GetNamesOfSchools() { String names [] = new String[numberofschools]; for(int i = 0; i<names.length; i++) { int realnumber = i+1; System.out.print("What is the name of school "+realnumber+" ? "); names[i] = scanner.next(); } System.out.println(" "); System.out.println(" "); System.out.println("#############################################"); System.out.println(" "); System.out.println(" "); // for (int i = 0; i<names.length; i++) // I only created this for loop // { // to make sure that the school // int realnumber = i+1; // names were being stored, // System.out.print("School number "+realnumber+" is ") // and that i could make it print // System.out.println(names[i]); // their names out. // } } }