This is what I have gotten so far:

import static java.lang.System.*; import java.util.*; import java.io.*; public class Eggs { public static void main(String[] args) throws Exception { Scanner file; file = new Scanner(new File("Eggs.txt")); { int count = file.nextInt(); for (int i = 0; i < count; i++) { int num = file.nextInt(); out.println(num/2 + 1/2); } } } }

And this is the actual problem:

Problem B: The Egg Seller

Input file: Eggs.txt

10

1

2

3

4

5

6

7

8

9

10

Output: System.out

Time Limit: 3 seconds

A puzzle from medieval times goes like this. A farmer stands in the market square selling chickens eggs from his basket. One day a curious thing happens. A series of customers buy eggs from him, leaving his basket empty (that's not the curious part.)Each of these customers bought a number of eggs equal to half of the eggs in the basket at that time, plus half an egg. Without rounding, each customer bought a whole number of eggs.If there were N customers, how many eggs did the farmer begin with? Write a program to solve this puzzle.

Input:A single integer, M, on a line by itself gives the number of test cases to follow. Then M lines follow, each containing a single integer N, (N <20), giving the number of customers in this test case.

Output:For each test case, output a single line giving the initial number of eggs in the farmers basket.

Sample Input:1 2

Sample Output:3

My output comes out as:

0

1

1

2

2

3

3

4

4

5

I know this is a simple problem to solve but I just can't figure out if I have to make/define any new variables. I've been trying to solve this for too much time and I haven't made any progress. I just need someone to guide me or any hints. Thanks.