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

Design and implement instantiable classes, Overview Goals: The goals for...

Overview Goals: The goals for this assignment are Design and implement instantiable classes. Use arrays of objects. Read from and write to files. Implement basic

Advantages of java stored procedures, Advantages of java stored procedures ...

Advantages of java stored procedures Transactions Although a saved process contains SQL orders, once collected it will socialize with SQL Hosting server very diversely from

Software architecture, Select two different architecture styles to design a...

Select two different architecture styles to design and implement a software system and provide its Architecture Diagrams (implement the software with java)

What is hiding a method? explain, Question 1 Explain the three traits of O...

Question 1 Explain the three traits of Object Oriented Programming Question 2 Write a note on (a) Assignment Operators                             b) Bitwise Operators.

Shell script, program for pyramid in shell script

program for pyramid in shell script

Java input stream, Expertsmind brings you unique solution in java assignme...

Expertsmind brings you unique solution in java assignments I.O streams The Java.io packages contains nearly every category you might ever need to execute feedback and resu

AWK programming, I have 9 assignments to be completed

I have 9 assignments to be completed

I need help in travel and photo sharing website, Vacation Envy - Travel and...

Vacation Envy - Travel and Photo Sharing Website Site Overview- Vacation Envy is a travel as well as photo-sharing site. Make your travel map, share photos and show off al

Discuss on unix kernel components, Question 1 Discuss on UNIX kernel co...

Question 1 Discuss on UNIX kernel components 2 Explain process creation and process termination 3 When do a Deadlock occur? What are the Necessary Conditions for Deadlock

Explain the use of sync and fsck, Problem 1 Define the architecture of ...

Problem 1 Define the architecture of UNIX operating system with appropriate diagram Problem 2 Define the term inter-process communication. What are several approaches t

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