Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.3 kB
4
Indexable
Never
import java.util.Scanner;

/*Part of this code was provided by the lecturer, as he suggested to use scanner. This I all I could create in the module using W3School and CodeAcademy */

public class EventAttendance {

    private static final int SPACE_SIZE_6 = 6;
    private static final int SPACE_SIZE_8 = 8;
    private static final int PLACE_CAPACITY = 56;

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);



        System.out.print("Enter the total number of people attending the event: ");

        int totalAttendees = scanner.nextInt();



        System.out.print("Enter the number of groups: ");

        int numGroups = scanner.nextInt();



        int[] groupSizes = new int[numGroups];



        for (int i = 0; i < numGroups; i++) {

            System.out.print("Enter the size of group " + (i + 1) + ": ");

            groupSizes[i] = scanner.nextInt();



        }



        System.out.println("Total Attendees: " + totalAttendees);

        System.out.println("Number of Groups: " + numGroups);

        System.out.println("Group sizes:");

        for (int i = 0; i < numGroups; i++) {

            System.out.println("Group " + (i + 1) + ": " + groupSizes[i]);

        }



        scanner.close();

    }

}