I am new to statistics so please bear with my question. There are some similar questions to mine but I didn't get the clear answer after reading them. I have a program that simulates the coin tossing situation. The user enters a guess and the program determines whether the user's guess is correct or not. Each user's guess will be considered as the null hypothesis. For example the user enters: the number of getting heads in 1000 coin flips is 400 if the probability of each single flip is 0.5. Then based on calculating the lower and upper critical values with the significance value of 0.05, the program informs the user whether their guess is correct or not. To code my program, I can think of two different ways:
(1) The program receives the number of flips from the user which is 1000 in this example and then does the 1000 flips for 100 separate times and when all experiments are done, the program calculates the mean of heads:
where each a(i) is the number of heads in each 1000 flips. Eventually if the calculated mean is between lower and upper critical values, the user's guess is accepted, otherwise it is rejected.
(2) We declare a variable t. Then the program repeats the 1000 flips experiment for 100 separate times, after each 1000 flips, if the number of heads is between the lower and upper critical values, the value of t is incremented by one. After all experiments are done, if the value of t is greater than 95 we accept the user's guess else we don't. (95 is the result of the number of experiments which is 100 multiplied by the significance value 0.05)
Now I wonder which of the above is logically correct to be safe from the Type 1 and Type 2 decision errors of hypothesis testing?