Microsoft Word - Assignment 2 CSIT111-Small MBP.doc CSIT111 Autumn Session 2019 Assignment #2 Due: by 21st April, 20:00 Resubmission is open: till 28th April, 20:00 Marks: 10 marks The purpose of this...

how long to do this and how much?



Microsoft Word - Assignment 2 CSIT111-Small MBP.doc CSIT111 Autumn Session 2019 Assignment #2 Due: by 21st April, 20:00 Resubmission is open: till 28th April, 20:00 Marks: 10 marks The purpose of this assignment is: • Classes and Objects • Strings • Expressions Read the assignment specification carefully, and make sure that you follow whatever directed in this assignment. In every assignment that you will submit in this subject, you must put the following information in the header of your assignment: /*------------------------------------------------------ My name: My student number: My subject code: My email address: Assignment number: -------------------------------------------------------*/ Make sure that you include this information in every assignment, otherwise it will not be marked OBJECTIVE Design, debug and test a Java program that performs arithmetic operations on fractions. Fractions are of the form a/b, where numerator a and denominator b are integers. For this assignment, it is assumed that both a>0 and b>0, and are represented only by a single digit value [1…9]. CODING REQUIREMENTS • Your program shall be well structured and designed using the concept of object oriented programming: follow the fundamental principles of the OOD when you define classes and relationship between them • Your program shall use command line arguments to get two fractions For example: java ArithmeticWithFractions 2/5 1/7 • You can presume that the number of command line parameters and their values are always entered properly according to the assignment specification. • Your program shall include meaningful comments and follow commonly accepted conventions regarding names of variables. • Your program shall produce the output in the format shown in the example below. Example: java ArithmeticWithFractions 2/5 1/7 --- Basic operations with fractions --- The sum: 2/5 + 1/7 = 19/35 The difference: 2/5 – 1/7 = 9/35 The product: 2/5 * 1/7 = 2/35 The quotient: 2/5 / 1/7 = 14/5 The program has terminated. The program structure shall be based on classes shown below: ArithmeticWithFractions -sum: Fraction -difference: Fraction -product: Fraction -quotient: Fraction +main(String[] args): void +displayResults(Fraction,Fraction): void> Calculator -fr1: Fraction -fr2: Fraction +Calculator(Fraction,Fraction): +addFractions(): Fraction +subtFractions(): Fraction +multFractions(): Fraction +divFractions(): Fraction -calcCommonDenominator(): int> Fraction +numerator: int +denominator: int +Fraction(int, int): +Fraction(): You need to work out your program architecture using major principles of the OOD methodology. You need to decide what relationship between classes is required to implement the program. You need to implement and use all methods specified in the UML class symbols. Method calcCommonDenominator returns the product of two denominators. DEVELOPMENT and TESTING To minimize time allocated for this assignment, you should develop your program incrementally, testing each new method added to the program (see Lecture5-6 for more details). As assignments are intended to assess students' understanding of the subject material covered in lectures, this assignment must be solved using only material covered in the lectures 1-6. As String type has been covered, you can use all relevant methods of this class (see Java API class String for more details). All classes must be defined in the same source file ArithmeticWithFractions.java. No package needs to be defined. Submission: Use submit program to submit your assignment: submit -u your_login_name -c CSIT111 -a 2 ArithmeticWithFractions.java The submitted file name must be ArithmeticWithFractions.java. Files with other names will not be tested and marked. NOTES: 1. Submit your assignment before the due date. You can resubmit later if necessary. Only the latest submission will be tested and marked providing that you have submitted at least one meaningful solution before the due date. Otherwise, resubmitted assignments will not be assessed. 2. Submission via email is not acceptable. 3. Assignments without properly filled assignment headers will not be marked 4. Enquiries about the marks can only be made within a maximum of 1 week after the assignment results are published. After 1 week the marks cannot be changed. Mark deductions: compilation errors, incorrect result, program is not up to spec, poor comments, poor indentation, meaningless identifiers, required fields and methods are not defined (or not used), the program uses approaches which has not been covered in the lectures. The deductions here are merely a guide. Marks may also be deducted for other mistakes and poor practices. Do not make any assumptions. Ask the lecturer if you have any questions regarding design requirements.
Apr 21, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here