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

  If the number on two of the players'' four cards

If the number on two of the players' four cards is the same and the number on the remaining two cards is also the same yet the number on all four cards in not the same then the player gets their bet back and in addition wins 22 chips for each chip th..

  Write an applet file that prompts the user for an id number

Catch the Exception and then display an appropriate message. Save the program as BadIDAndAge.java

  How do you create a list using a listview control

Discussion questions for Android Develpers. How do you create a list using a ListView control? Discuss adding the Images to the Resources Folder.

  On any given execution your program

On any given execution your program will produce just one version of the figure. However, you should refer to the class constant throughout your code, so that by simply changing your constant's value and recompiling, your program would produce a f..

  Developing a java application

You have been requested to develop a Java application for the local library as part of an upgrade initiative. As in all libraries, this is a place where one can check out books

  Important components of a script

Bash scripting can be a very useful tool to manage Linux servers and workstations. The important components of a script include variables, keyboard input, terminal output, decision making, and loops. Give some simple examples of bash script that i..

  Briefly explain the code in sort inventory

Draw a UML diagram of the Shoe class using the code that has been provided - Briefly explain the code in sort Inventory. What is the inventory being sorted by? What is the sort algorithm that is being used. Explain in words how it works. Why do you..

  Write a function which takes two string variables

Write a function which takes two string variables not C strings as inputs and compares them. If they are equal, the function should return 0. If the first-string is less than the second string, return a negative number. If the first string is grea..

  Write a java program to list odd numbers

Q1:Scenario: Write a Java program to list Odd numbers between 1 to any user given input number.Typical run of the program

  What would you do to make code execute

The class above is not a complete Java program that could execute. What would you do to make it execute? Change the program, or add a source code file, to make it into a Java program that executes.

  What is an array and how do you create one

What is an array and how do you create one? What is the name of the content provider for accessing media on the phone and on external storage devices?

  Part - 1build a graphical user interface for displaying the

part - 1build a graphical user interface for displaying the image groups cluster in jmjrst. design and implement using

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