Looking for very noob friendly java program with comments

Dec 14th, 2014
Price: $10 USD

Question description

Write a program in Java and run it in BlueJ according to the following specifications:

  • The program first generates three random rational numbers (fractions) and prints them both as rational numbers and as floating point numbers.
  • Then it finds the rational numbers that reperesent the maximum value and the minimum value and prints them (both as rational numbers and floating point numbers).
  • Finally it also prints the sum and the average of the three rational numbers as rational numbers reduced to lowest terms as well as floating point numbers.
  • The output of the program may look like the following:

Rational numbers: 2/5, 4/5, 6/4 (Floating point format: 0.4, 0.8, 1.5)
Maximum: 6 / 4 (1.5)
Minimum: 2 / 5 (0.4)
Sum: 27 / 10 (2.7)
Average: 9 / 10 (0.9)

Requirements and restrictions:

  • Use the roll() method from Die.java class to generate random numerators and denominators for the rational numbers.
  • Use the Rational.java class from the course website to represent rational numbers and extend it with:
    • a method to compare two rational numbers
    • and a method to divide rational numbers.
    • a method that returns the floating point value of a rational number.
  • All calculations, comparisons and printing should be implemented with methdos that work with rational numbers only:
    • Use the method to compare rational numbers to find the minimum and the maximum.
    • Use the sum method from the Rational.java class and the method to divide rational numbers to find the average.
    • Use the reduce method from class Rational to reduce the sum and the average to lowest terms.
    • For printing use the method that returns the floating point value of a rational number.
  • When you write your program
    • use proper names for the variables suggesting their purpose.
    • format your code accordingly using indentation and spacing.
    • use multiple line comment in the beginning of the code and write your name, e-mail address, class, and section.
    • for each line of code add a short comment to explain its meaning.

The files are here Number 4.rar 

Tutor Answer

(Top Tutor) johnalia
School: University of Virginia

Studypool has helped 1,244,100 students

Review from student
" Outstanding Job!!!! "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1820 tutors are online

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors