COSC2429_2012A_A2
Click here to load reader
-
Upload
nguyen-vu-hoai -
Category
Documents
-
view
214 -
download
0
Transcript of COSC2429_2012A_A2
8/2/2019 COSC2429_2012A_A2
http://slidepdf.com/reader/full/cosc24292012aa2 1/2
COSC2429 Introduction to Programming
Assignment 2 (15%)
Deadline: 11.59 pm Monday of week 10 (Apr 23, 2011)
Write a Java program with two classes as follow:
One class called SimpleCal with 6 operations. The first four functions perform 4
basic calculations add (+), subtract (-), multiply (*), and divide (/). Each function has
2 parameters (double) and returns the result in double. In addition, SimpleCal has
a function which takes a positive integer as parameter and return true if that integer
is a prime and false if it is not. SimpleCal also has another method that takes a
positive integer as parameter and prints out all the prime numbers that are smaller
than or equal to that parameter.
The other class is World with 2 methods:• showMenu: prints out the menu as follow:
Simple Calculator Menu:
1 – Add (+)
2 – Subtraction (-)
3 – Multiply (*)
4 – Divide (/)
5 – Check prime number
6 – Print prime numbers
7 - Exit
• main: allowing the user to select a choice from the above menu and then enter
additional input(s) depending on the operation selected. After that, run the
relevant function/method & print out the result(s) of the operation.
You can assume that the user will always enter correct the data types as required but
he/she may enter unsuitable values. In that case, you should allow the user to re-enter
until the value(s) are valid. You are allowed to create additional properties,
methods/functions as you find appropriate.
8/2/2019 COSC2429_2012A_A2
http://slidepdf.com/reader/full/cosc24292012aa2 2/2
Deadline & Submission
The deadline of this assignment is 11.59 pm Monday of week 10 (Apr 23,
2012). Before the deadline, you must submit your assignment to Blackboard as
follows:
1. Create a folder named studentNumber_FullName_A2. Example:
s1234567_NguyenVanMinh_A2 2. Copy your Java program (the whole NetBeans project folder of the Java program)
into the above folder.
3. Compress the folder into a zip file using 7-Zip. The zip file now should have the
name as studentNumber_FullName_A2.zip. Example:
s1234567_NguyenVanMinh_A2.zip 4. Submit the zip file by uploading it to Blackboard > COSC2429 > Assignments
> Assignment 2. Remember to click at "Submit", not "Save", to have your
assignment submitted because "Save" will not submit your assignment. You must
use Internet Explorer to submit as the submission feature in Blackboard doesn'twork with other web browsers.
Note that Blackboard only allow you to submit ONE TIME thus you must carefully
review your files before submitting and follow the above instructions strictly. Failure
to do so will result in a 50% or 100% penalty of the assignment.
Late submission of assignments will be penalised as follows:
• For assignments 1 to 5 days late, a penalty of 10% (of total available marks) per
day.
• For assignments more than 5 days late, a penalty of 100% will apply.
Plagiarism NoticeThis assignment is an individual assignment thus it must be your own work. Any
submission found in whole or in part plagiarized will be given zero marks and will not
count towards your assessment. If an award of zero marks means that you do not pass
the assignment hurdle then you will fail the course.
Marking Criteria
Criteria Marks
Correct program behaviours, calculation and display as required 15Correct program design (classes/objects, properties,
methods/functions, parameters) and good use of method variables 10
Good coding style (follow Java naming convention, good
indentation, have relevant comments in code) 5
Total 30