Create a fraction calculator program, Programming Languages

Assignment Help:

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)


Related Discussions:- Create a fraction calculator program

Game programming, Companies divide their subtasks of game's development. Fo...

Companies divide their subtasks of game's development. For large complex games, the development team can vary in size from 20 to 100 or more members. The most represented are artis

Write an xslt-flatten the tree, Flatten the tree Consider the followin...

Flatten the tree Consider the following XML input, which groups people into two categories-salaried and hourly: Warren Rosenbaum 37 5.75

Develop a windows forms application, Develop a Windows Forms Application by...

Develop a Windows Forms Application by creating a new project named "xxxxxxxx" in a new folder named "xxxxxxxxas3" where xxxxxxxx is your student id. You should delete file(s) with

Matlab, want to do an image-mean. but image is and mean is so an error ...

want to do an image-mean. but image is and mean is so an error showing Error using ==> minus Number of array dimensions must match for binary array op. wat to do?

Difference between java and j2ee programming, Difference between java and j...

Difference between java and j2ee programming In the basic form, the phrase java is placed as a selection terminology. On the other hand, the phrase J2EE is placed as a renderin

Java string handling, Expertsmind brings you unique solution in java assig...

Expertsmind brings you unique solution in java assignments String Handling Series signifies a sequence of character types. It has set duration of personality sequence. Onc

Ws-addressing, WS-Addressing, WS-Reliable Texting and WS-Security WCF tools...

WS-Addressing, WS-Reliable Texting and WS-Security WCF tools many innovative Web solutions (WS) expectations such as WS-Addressing, WS-Reliable Texting and WS-Security. With the di

Dot net technology, write a procedure to add toolbar in VB application addi...

write a procedure to add toolbar in VB application adding icons to toolbar buttons & with the approprite example display the use of each button

Class Project, I need help getting started with a class project of creating...

I need help getting started with a class project of creating a project in the Perl programming language. I was thinking of maybe doing an employee directory

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd