Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

You need to create a Fraction calculator program.You need to create a Fraction class to represent fraction objects and a FractionCalculator class that will perform operations on fractions. Make sure you use input validation, so your program doesn't crash.

Requirements for Class Components:

• You need to create a Fraction class that stores information regarding fractions.

o The class should have private instance fields for this class called numerator and denominator.

o You need properties to get/set these values.
 Name them Numerator and Denominator.
o The class needs a constructor that accepts two strings that are used to construct a fraction object: one for the numerator, and one for the denominator.

o The class needs a constructor that accepts two integers that are used to construct a fraction object.

o You need an Equals() method that returns true when a fraction passed into the method is equal to the fraction object the method was called upon.

 Example: If frac1.equals(frac2) Then ...

o You need a ToString() method that returns a string representation of a fraction.

For example, a fraction with a numerator of 5 and a denominator of 6 would return "5/6" when the ToString method is called.

• You need to create a FractionCalculator class will be responsible for working with two fractions.

o This class should be used to perform addition, subtraction, multiplication, and divide.

o The Add, Subtract, Multiply, and Divide methods should take two fractions objects as input and return a new fraction which is the result of the operation that was performed on the two input fractions.

o This class needs a Swap() method that will accept two fraction objects and swap them.

o This class needs an Invert() method that will accept a single fraction object and swap the numerator and denominator.
 For example, fraction "3/4" becomes "4/3"

o Try creating a Reduce() method to simply fractions for an extra credit challenge.

 Hint: you will need recursion and the Euclidean Algorithm.

User InterfaceRequirements:

• You need to create a form that allows the user to enter two fractions, perform a specific operation (+, -, *, /, swap, and invert), and display the results.

• Display clear instructions to the user where necessary.

Fraction Help:

Adding fractions: a/b + c/d
(ad + bc) / bd

Subtracting fractions: a/b - c/d
(ad - bc) / bd

Multiplying fractions: a/b * c/d
(a * c) / (b * d)

Dividing fractions: (a/b) / (c/d)
(a * d) / (b * c)

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M9522027

Have any Question?


Related Questions in Programming Language

Question 1 what is a computer program what is structured

Question: 1. What is a Computer program? What is structured programming? 2. What is modular programming? Why we use it? 3. Please evaluate Sin (x) by infinite series. Then write an algorithm to implement it with up to th ...

Assignment - haskell program for regular expression

Assignment - Haskell Program for Regular Expression Matching Your assignment is to modify the slowgrep.hs Haskell program presented in class and the online notes, according to the instructions below. You may carry out th ...

1 write a function named check that has three parameters

1. Write a function named check () that has three parameters. The first parameter should accept an integer number, andthe second and third parameters should accept a double-precision number. The function body should just ...

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Question 1 what is hadoop explaining hadoop 2 what is

Question: 1. What is Hadoop (Explaining Hadoop) ? 2. What is HDFS? 3. What is YARN (Yet Another Resource Negotiator)? The response must be typed, single spaced, must be in times new roman font (size 12) and must follow t ...

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Structs and enumsoverviewin this task you will create a

Structs and Enums Overview In this task you will create a knight database to help Camelot keep track of all of their knights. Instructions Lets get started. 1. What the topic 5 videos, these will guide you through buildi ...

Task - hand execution of arraysoverviewin this task you

Task - Hand Execution of Arrays Overview In this task you will demonstrate how arrays work by hand executing a number of small code snippets. Instructions Watch the Hand Execution with Arrays video, this shows how to ste ...

Task silly name testeroverviewcontrol flow allows us to

Task: Silly Name Tester Overview Control flow allows us to alter the order in which our programs execute. Building on our knowledge of variables, we can now use control flow to create programs that perform more than just ...

Question - create a microsoft word macro using vba visual

Question - Create a Microsoft Word macro using VBA (Visual Basic for Applications). Name the macro "highlight." The macro should highlight every third line of text in a document. (Imagine creating highlighting that will ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As