Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

When a programming language does not support a needed data type, a programmer must create an abstract data type (ADT). Examples of data types that might have to be created are Complex Numbers (a + bi) or Fraction (n/d). These abstract data types created by a programmer would be released to the user community to be used like Integer or Double. That means a class would be created that implements the desired ADT. You are to create and ADT Fraction in its own file. Fraction must consist of: 2 state variables num (numerator) and den (denominator). a default and 2 parameter override constructor so you can use new Fraction(); or new Fraction(a,b); a toString() that produces output like 1/2 an equals(Fraction f) that compares using: return getNum()*f.getDenom() == f.getNum()*getDenom(); Write an appropriate test program in a separate file. Your test program should read in numerators and denominators and create Fraction instances for comparison.

Possible Example Output: --------------------Configuration: -------------------- Enter the numerator for the target fraction: 1 Enter the denominator for the target fraction: 2 Enter the numerator for the next fraction to test: 2 Enter the denominator for the next fraction to test: 4 The fraction you just entered equals the first fraction of 1/2. Would you like to continue (Y/N)? y Enter the numerator for the next fraction to test: 3 Enter the denominator for the next fraction to test: 4 The fraction you just entered does not equal the first fraction of 1/2. Would you like to continue (Y/N)? n Process completed.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9451191

Have any Question?


Related Questions in Computer Engineering

A country has a total of three cities and city a has a

A country has a total of three cities and city A has a population of 550,000 and city B has a population of 200,000 and city C a population of 10,000. Sixty physicians in the country. The per capita demand for medical ca ...

Suppose that a data warehouse consists of the four

Suppose that a data warehouse consists of the four dimensions date, spectator, location, and game, and the two measures count and charge, where charge is the fare that a spectator pays when watching a game on a given dat ...

Suppose that you want an operation for the adt list that

Suppose that you want an operation for the ADT list that adds an array of items to the end of the list. The header of the method could be as follows. public void addAll(T[] items) Write an implementation of this method f ...

Suppose a life insurance company sells a 230000 one-year

Suppose a life insurance company sells a $230,000 ?one-year term life insurance policy to a 20?-year-old female for ?$330. The probability that the female survives the year is 0.999642. Compute and interpret the expected ...

Consider a tcp connection between two hosts that are 400

Consider a TCP connection between two hosts that are 400 miles away from each other (propagation delay is 100 miles per msec.). Assume that there is no error or loss in this communication and the receive window size is s ...

What are some skills individuals who work in the field of

What are some skills individuals who work in the field of cyber security need to prevent hacks in to a company's computers?

Whats the difference between a bigfile tablespace and a

What's the difference between a Bigfile tablespace and a Smallfile tablespace? Explain which you would use for your database and why.

Question students will turn a basic python set of files

Question : Students will turn a basic Python set of files into one single batch file. This will demonstrate students understanding of sequential scripting. Student will developed a simple 3-6 line code script file. Using ...

Represent the number obtained by the last you have digits

Represent the number obtained by the last you have digits of your student number in binary, e.g., if your student number is XXX8372 then the question is to represent "8372" in binary. Also, represent the first three digi ...

Runtime vs realtime considerations1 research the concept of

Runtime vs. Realtime Considerations 1. Research the concept of compilation with regards to code. 2. Is there a difference in how scripts are compiled vs. how programs are compiled? 3. What is the difference between compi ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As