Question: Java Create a class named Percentages whose main() method holds two double variables, and prompt the user for values. Pass both variables to a method

Java
Java Create a class named Percentages whose main() method holds two double

Create a class named Percentages whose main() method holds two double variables, and prompt the user for values. Pass both variables to a method named computePercent() that displays the two values and the value of the first number as a percentage of the second one. For example, if the numbers are 2.0 and 5.0, the method should display a statement similar to: 2.0 is 40 percent of 5.0. Then call the method a second time, passing the values in reverse order. An example of the program is shown below: Enter a double 3.7 Enter another double 12.3 3.7 is 30.081300813008127 percent of 12.3 12.3 is 332.43243243243245 percent of 3.7 Tasks Create the Percentages class. The computePercent () method displays the percent of the first argument of the second argument. The Percentages program accepts 2 double values from the console and displays the percent of first value of the second value and vice versa

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!