Question: Question 2 (35 marks) A MixedFraction can be represented by three data members namely whole, numezator and denominator. All data members are integers Identify suitable

 Question 2 (35 marks) A MixedFraction can be represented by three

data members namely whole, numezator and denominator. All data members are integers

Question 2 (35 marks) A MixedFraction can be represented by three data members namely whole, numezator and denominator. All data members are integers Identify suitable coding modules for the MixedFraction class with the following specifications (a) Define the three data members: whole, numerator and denominator 3 marks) (b) Implement a parameterised constructor that receives three arguments that represent the values of whole, numerator and denominator respectively. The constructor will initialise the three data members with the arguments with the following rules. An error message is displayed if the value of denominator is 0. The constructor replaces the denominator with the value1 The constructor uses the lowestTerm () function to convert the fraction into its lowest term. If the numerator is greater than or equal to the denominator, then numerator is decreased by the value of denominator and the value of whole is increased by 1. This is repeated until the value of numerator is less than the value of denominator

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!