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

  Product ordering system and design

Product Ordering System and Design Document:Select a company and one of its products for which you will be creating an online ordering system. Get your instructor's approval for your selections

  Write thejava code for a program

Write theJava code for a program that reads the weight of a piece of luggage and print the proper message, depending on the weight, as per the table below.

  Display the value stored at the index

Display the value stored at the index. Take a screenshot to verify that the words in your Array or ArrayList are displayed successfully.

  Write a java program that accepts a positive long integer

Write a Java program that accepts a positive long integer between 2 to 15, and then using the number, calculate its factorial (n!). Using do-while statement, make sure it only accepts a valid number (between 2 and 15) - if an invalid number is ent..

  Analyze some of the limitations a web designer should aware

Analyze some of the limitations a Web designer should be aware of before adding JavaScript to a Website. Determine if these limitations outweigh the benefits of using JavaScript. Explain your decision.

  Create a file that contains your favorite movie quote

Create a file that contains your favorite movie quote. Use a text editor such as Notepad, and save the file as quote.txt. Copy the file contents,

  Why do regulators mandate the use of spread spectrum

Why do regulators mandate the use of spread spectrum and what are some spread spectrum transmission options?

  Prepare a java application will read the database file

Prepare a java application will read the database file. The path of the database file will be supplied by a run-time parameter. If the database file does not exist, the user will be told the database does not exist.

  Code the given java application

Using NetBeans, code the following Java application, and run it on Command prompt (Terminal If Linux) with the argument "notepad" (or "gedit" if Linux).

  Implement a simple number guessing game using html forms

Your assignment is to implement a simple number guessing game using HTML forms and a Java servlet. The HTML page should introduce the game and provide a form for the user to guess a number on. The servlet should use an HTTP session object to store..

  Write a recursive method called maxsum

write a recrusive method called maxSum that accepts a list of integers. L, and an integer limit n as parameters and use backtracking to find the maximum sum that can be generated by adding elements of L that do not exceed n.

  What are some more popular methods utilizing string class

What are some of the more popular methods utilizing the "String" class? Show examples of their usage. Java gives us the ability to do output to the console screen in many ways. What is the difference between printing and printf? Show an example of ..

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