These are the instructions given to the graders when they graded
Quiz 2.
If the program does not compile and/or not run, you need to look at the code,
and manually trace it to find out why.
Sample Output
Welcome to the integer sequence generator!
Please enter an integer:
5
The first 5 even numbers are:
0 2 4 6 8
The first 5 powers of 2 are:
2 4 8 16 32
The first 5 prime numbers are:
2 3 5 7 11
============================================================================
Welcome to the integer sequence generator!
Please enter an integer:
15
The first 25 even numbers are:
0 2 4 6 8 10 12 14 16 18 20 22 24 26 28
The first 25 powers of 2 are:
2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768
The first 25 prime numbers are:
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47
Point Distribution
- 15 points: Good programming practices
They only had to include a few of these (max -15)
- -5 missing name or email ID
- -5 for excessively long lines in code
- -5 for excessive whitespace (more than 2-3 lines)
- -5 for bad indentation
- -5 for bad variable names
- -5 for making one or more variables final that shouldn't be
- 20 points: method declarations
(max of -20 pts)
- -5 wrong return type (per method)
- -5 wrong number of parameters
- -5 wrong type of parameters
- -5 not declared as public and static
- -5 incorrect printing of results (includes NOT printing results)
- -5 for not calling any of the methods in main()
- 25 points: public static void printEvenNumbers(int n)
(max -25)
- -10 doesn't use loops
- -3 loop initialization incorrect
- -3 loop condition incorrect
- -3 loop increment performed incorrectly
- -5 calculation for even numbers incorrect
- 25 points: public static void printPowersOfTwo(int n)
(max -25)
- -10 doesn't use loops
- -15 uses Math.pow
- -3 loop initialization incorrect
- -3 loop condition incorrect
- -3 loop increment performed incorrectly
- -5 calculation for powers of two incorrect
- 15 points: public static void printPrimeNumbers(int n)
(max -15)
- -10 doesn't use loops
- -15 uses some JDK primality testing methods (e.g.
BigInteger.isProbablePrime(), etc. )
- -3 outer loop initialization incorrect
- -3 outer loop test condition incorrect. Doesn't properly count the number of primes
- -3 outer loop increment performed incorrectly
- -3 for inner or outer loop missing
- -3 inner loop initialization incorrect
- -3 inner loop test condition incorrect
- -3 inner loop increment performed incorrectly
- No point deduction if the parameter is int,
but they print results as doubles
- -5 calculation for prime numbers incorrect. Examples include
- Reversing condition for determining prime (prints out numbers that have factors instead)
- Uses continue instead of break
|