Faculty of Information & Communication Technology

Assignment #1

Due: Friday 27th April 2012, 6:00pm

BPROG1203 - Java Programming 1

Department: Faculty of Information & Communication Technology

Course Name: B Sc (Hons) in Business Information Technology

B Sc (Hons) in Information Technology

B Sc (Hons) in E-Commerce

B Sc (Hons) in Software Engineering with Multimedia

B Sc (Hons) in Mobile Computing

Semester : 2

Commence Date : Week 5

Deadline Date : Week 9

Unit Controller / Examiner : Mohsen Mohebali

Contact Number : 8403

E-mail :

You are to complete this assignment in a group of not more than two students. You are not allowed to work with other students from other groups, or do your work based on another program that is available from the internet, or any other source. You must write the program from scratch.

It is reasonable to discuss with others possible general approaches to the given problems. It is unreasonable to work together on a detailed solution, to copy a solution, or to give away a solution. If your common discussion can be detected by looking at the solutions, then there is too much collaboration. Such instances of academic dishonesty may result in you getting zero marks for your assignment, and your names will be forwarded to the faculty moderator and program leaders for further action.

Do not allow your work to be used by others:

●Do not let others see your solution.

●Do not e-mail your solution to anyone.

Warning: If someone cheats by using your work, you will also be penalized.

Tasks

You are required to complete both task ONE and TWO and any of the elective tasks (total of THREE).

Task 1

Write a program that generates every prime number between two given numbers.

Input

There are two numbers m and n. The user must be able to key in the range. Appropriate prompts are needed.

Output

Print all prime numbers p such that m <= p <= n. Numbers must be separated using space or one number should be printed per line.

Example

Input:
1 10
Output:
2
3
5
7

Task 2

Write a program that get the user’s birthday (two numbers - month and day) and prints his/her zodiac sign.

Input

Two numbers:

1.Number of the month (Jan = 1, Feb = 2, …., Dec = 12)

2.Day of the month (1, 2, …., 31)

Output

The corresponding zodiac sign for the user input. Refer to the table below:

Symbol / Sign Name / English Name / Period
/ Capricorn / The Goat / December 22 - January 20
/ Aquarius / The Water-Bearer / January 21 - February 18
/ Pisces / The Two Fish / February 19 - March 20
/ Aries / The Ram / March 21 - April 20
/ Taurus / The Bull / April 21 - May 20
/ Gemini / The Twins / May 21 - June 21
/ Cancer / The Crab / June 22 - July 22
/ Leo / The Lion / July 23 - August 22
/ Virgo / The Virgin / August 23 - September 22
/ Libra / The Scales / September 23 - October 22
/ Scorpio / The Scorpion / October 23 - November 21
/ Sagittarius / The Archer/Centaur / November 22 - December 21

Example

Please enter the day of your birthday: 1

Please enter the month of your birthday 12

You are a Capricorn (The Goat).

Elective Tasks (choose one only)

Task 1

Write a program a program that reads a number (integer) and prints the reversed number.

Input

A number. Must be integer.

Output

The reversed number.

Example

Please enter an integer value: 987654321

The reversed value is: 123456789

Task 2

Write a program that gets an integer as input and determines whether the number entered is a palindrome. Numeral palindrome is a 'symmetrical' number like 16461.

Input

A number. Must be integer.

Output

The output must indicate if the number entered was a palindrome

Example

Please enter an integer: 1234566

The number entered is NOT an palindrome.

Please enter an integer: 12344321

The number entered is an palindrome.

Important Note: Your programs should allow the user to repeat the sequence of the application without exiting the program. For instance, after completing the required task, the program should ask the user if they want to continue. If yes, the program must repeat. If no, the application exits.

Due Date

Everyone must submit by Friday 27th April 2012, 6:00pm.

After the due date no submission will be accepted under any circumstances whatsoever.

The Submission

You are required to submit a softcopy of your program bundled along with the hardcopy of your report. The report must include following items:

●Cover page (your group’s details)

●Marking sheet (take from next page)

●Algorithms and pseudo codes (bonus)

●Work distribution (who did what)

●References (if any)

●Source codes

Marking Scheme

Max. / Mark Given
a. Source Code (50%)
i. Code efficiency and strategy / 25
ii. Error reporting capabilities / 5
iii. Programming Style / 20
b. Program execution* (50%)
i. Performs all required features / 25
ii. User friendliness / 10
iii. Error free during runtime / 10
iv. Program output readability and quality / 5
c. Bonus
i. Self-Documentation** / 15
ii. Algorithm and pseudo codes / 20
TOTAL / 100 + 35

Notes:

* If the program cannot run even if it can compile, zero mark will be given for the execution section.

** The code should be described with proper use of comments.

The End

Good Luck. :)

Page 1 of 7