Looking for very noob friendly java program with comments
Looking for very noob friendly java program with comments
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
"You need a similar assignment done from scratch? Our qualified writers will help you with a guaranteed AI-free & plagiarism-free A+ quality paper, Confidentiality, Timely delivery & Livechat/phone Support.
Discount Code: CIPD30
Click ORDER NOW..


