CSC 201 Computer Science – I Homework – 1 Out: Thursday, Sept 3rd 2009 Due: Thursday, Sept 10th 2009 Instructions 1) All the Homeworks are individual assignments. No group work allowed. 2) Please submit a hard copy of the assignment before start of the class by 11:05 AM. If an assignment is due Tuesday, please submit it by 10:05AM (No Exceptions). 3) Please include proper comments in your programs. 4) If it is a programming assignment, you would need to submit both electronic copy (to
[email protected]) and a hard copy. Same timings apply for both the submissions. 5) Non-submission of homework electronically OR manually will result in a ‘0’ in that homework. 6) Please read and understand the Cheating Policy mentioned in the course outline document. 7) Any questions/concerns should be directed to the Professor. Homework – 1 1) Write an algorithm and a Java Program for the following: Generate a random Integer between 1 and 10. User is then prompted to enter a limit for generating even numbers. Generate even number between 1 and user entered limit (maximum value 10). Keep checking if the generated even number matches the random integer you generated previously and print the output as mentioned below. Example: Sample Run: A Random number generated is: 2 Enter the limit for printing even numbers: 5 The number 1 is not an even number The number 2 is an even number The number 2 matches the random number: 2 The number 3 is not an even number The number 4 is an even number The number 5 is not an even number
Sample Run: When the random number generated is not an even number. A Random number generated is:1 Enter the limit for printing even numbers: 5 The number 1 is not an even number The number 2 is an even number The number 3 is not an even number The number 4 is an even number The number 5 is not an even number
2) What is Just-In-Time-Compiler (JIT) in Java? 3) Explain ‘?:’ operator in Java programming language with an example.