Question: Write a Java class, called RatioClass, with three attributes a (int), b (int), and ratio (double). Write another Java class, called Compute Ratio, with

Write a Java class, called RatioClass, with three attributes a (int), b (int), and ratio (double). Write another Java class, called Compute Ratio, with a main method which reads two positive integers a and b, and the creates a RatioClass object called r that will be used to store the values entered by the user. The main method should validate the user input for the value of b as being different from zero. Each time the user enters a zero value for b, an error message should be displayed and the user should be asked to enter the number again. When the user enters a non-zero value for b, the program should store the ratio a/b in the ratio attribute of the created object r, and display the ratio on the screen.
Step by Step Solution
There are 3 Steps involved in it
Heres the implementation of the RatioClass and ComputeRatio classes in Java java import javautilScan... View full answer
Get step-by-step solutions from verified subject matter experts
