Question: Write a Java class, called RatioClass, with three attributes a ( int ) , b ( int ) , and ratio ( double ) .
Write a Java class, called RatioClass, with three attributes a int b int and ratio double Write another Java class, called ComputeRatio, 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 nonzero value for b the program should store the ratio ab 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
