Create a class for working with mixed fractions

Assignment Help JAVA Programming
Reference no: EM131306337

Exam Program: Create a class for working with mixed fractions. Only 3 private data members are needed: the int whole number part of the fraction, the int numerator of the fraction, and the positive int denominator of the fraction. For example, the fraction 3 5/8 will have the three private data member values of 3, 5, and 8.

The following methods should be in your class:

a. A default constructor that should use default arguments in case no initializers are included in the main. The fraction needs to be stored in reduced form. Make sure the denominator is not set to 0 or a negative value.

b. Add two mixed fractions and store the sum in reduced form.

c. Subtract two mixed fractions and store the difference in reduced form.

d. Multiply two mixed fractions and store the product in reduced form.

e. Divide two mixed fractions and store the quotient in reduced form

f. Print a mixed fraction.

g. Change a fraction to its reciprocal. For example, the reciprocal of the fraction 3 5/8 is 8/29. The reciprocal of 4/19 is 4 3/4.

Your main should instantiate two mixed fractions and call each of the class methods. The two mixed fractions should be printed along with the sum, difference, product, quotient, and after being changed to its reciprocal. (Please do not overload the operators for this program.)

Reference no: EM131306337

Questions Cloud

What is addition to retained earnings : California Retailing Inc. has sales of $4,000,000, the firm's cost of goods sold is $2,500,000, and it’s total operating expenses are $600,000. The firm’s interest expense $250,000, and the corporate rate is 40%. The firm paid dividends to preferred ..
Do the organizations compete with one another : You'll also want to discuss how the two are related - do they have similar missions, but differ in their geographic focus? Do the organizations compete with one another? Do they collaborate?
What is the present value of investment : Dynamics Telecommunications Corporation has made an investment in another company that will guarantee it a cash flow of $22,500 each year for the next five years.  If the company uses a discount rate of 15 percent on its investments, what is the pres..
The task is to analyze available sources of finance : The task is to analyze available sources of finance for a selected SME entity. What sources of finance are available for the selected entity? What is the cost of capital in your selected company based on your previous learning?
Create a class for working with mixed fractions : Create a class for working with mixed fractions. Only 3 private data members are needed: the int whole number part of the fraction, the int numerator of the fraction, and the positive int denominator of the fraction.
What is the current price of jeeps stock : Jeep recently paid a dividend of $1.25. Dividends are expected to grow at a 10% percent rate for the next three years. Beginning in the fourth year, revenue growth is expected to slow and thus dividends are expected to slow to 4% thereafter. If the c..
What is the yield to maturity of the bond : A five-­-year, $5,000 bond with a 4.5% coupon rate and semiannual coupons is currently trading for a price of $4,876.  What is the yield to maturity of the bond?
Ways an individual might handle a cash flow deficiency : Name some ways an individual might handle a cash flow deficiency. Which way would be preferable? Why?- What is the opportunity cost of having excessive amounts of liquid funds?
Mortgage lender-what will his monthly payment be : Patrick is purchasing a new home and needs to borrow $250,000 from a mortgage lender. The mortgage lender quotes him a rate of 6.25% APR for a 30-­-year fixed rate mortgage. What will his monthly payment be?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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