Question
LO: (Apply) Students will use arrays to verify some property of a dataset. Some students have organized an election to determine the new leaders of
LO: (Apply) Students will use arrays to verify some property of a dataset.
Some students have organized an election to determine the new leaders of their school club. Each member of the club has a unique ID that they can use when they vote. However, the election managers suspect that some members have voted twice.
Write a program to read in member IDs and check if there are any repeated values. If an ID has already been used, output a line in this format:
REPEAT: The ID BE45N6 has already been counted!
Stop reading input after reading the value "STOP". Then output a line showing how many unique members voted in this format:
After excluding repeats, 45 unique members voted.
Code
public class UniqueMembers {
public static void main(String[] args) { // TODO: Write your code here System.out.println("REPEAT: The ID " + "AA00A0" + " has already been counted!"); System.out.println("After excluding repeats, " + 0 + " unique members voted."); }
}
Test Case
Another test case
DEBUG INFO Your instructor has chosen to give you the following information to help you debug your code and improve your submission. COMPILER STACK TRACE None PROGRAM EXECUTION STACK TRACE None INPUT OF THE TEST CASE 1 GHB549 2 123456 3 GHB549 4 654321 5 GHB549 6 KRH592 7 101010 KRH592 9 KRH592 10 STOP YOUR CODE'S OUTPUT REPEAT: The ID AADDAD has already been counted! After excluding repeats, a unique members voted. 2 3 THE CORRECT OUTPUT OF THE TEST CASE 1 2 3 4 REPEAT: The ID GHB549 has already been counted! REPEAT: The ID GHB549 has already been counted! REPEAT: The ID KRH592 has already been counted! REPEAT: The ID KRH592 has already been counted! After excluding repeats, 5 unique members voted. 6 UNIX DIFF OF CORRECT OUTPUT AND YOUR OUTPUT 1,2c1,5 REPEAT: The ID GHB549 has already been counted! > REPEAT: The ID GHB549 has already been counted! > REPEAT: The ID KRH592 has already been counted! > REPEAT: The ID KRH592 has already been counted! > After excluding repeats, 5 unique members voted. PRETTY DIFF This diff is colored to make it clear what parts of the output are wrong. Green indicates things in the correct output that you are missing, indicates things in your output that shouldn't be there. The character refers to newlines, so the green character refers a newline you are missing in your output and the red refers to a newline you need to remove from your output. 1 REPEAT: The ID GHB549 has already been counted! 2 REPEAT: The ID GHB549 has already been counted! 3 REPEADOT: The ID KRH592 has already been counted! 4 REPEABT: The ID KRH592 has already been counted! Acta avud au bas votada DEBUG INFO Your instructor has chosen to give you the following information to help you debug your code and improve your submission. COMPILER STACK TRACE None PROGRAM EXECUTION STACK TRACE None INPUT OF THE TEST CASE 1 48F99G 2 48F99G 3 STOP YOUR CODE'S OUTPUT 1 REPEAT: The ID AADCAO has already been counted! 2 After excluding repeats, unique members voted. 3 THE CORRECT OUTPUT OF THE TEST CASE 1 REPEAT: The ID 48F996 has already been counted! 2 After excluding repeats, 1 unique members voted. 3 UNIX DIFF OF CORRECT OUTPUT AND YOUR OUTPUT 1,2c1,2 REPEAT: The ID 48F99G has already been counted! > After excluding repeats, 1 unique members voted. PRETTY DIFF This diff is colored to make it clear what parts of the output are wrong. Green indicates things in the correct output that you are missing, indicates things in your output that shouldn't be there. The + character refers to newlines, so the green character refers a newline you are missing in your output and the red refers to a newline you need to remove from your output. 1 REPEAT: The ID AADOA@48F99G has already been counted! 2 After excluding repeats, unique members voted. 3Step 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