Question: Modify the Percentages2 class derived from Chapter 3 Exercise 5A to accept the values of the two doubles from a user at runtime. An example

Modify the Percentages2 class derived from Chapter 3 Exercise 5A to accept the values of the two doubles from a user at runtime.

An example of the program is shown below:

Enter a double >> 2.5 Enter another double >> 5.0 2.5 is 50.0 percent of 5.0 5.0 is 200.0 percent of 2.5Modify the Percentages2 class derived from Chapter 3 Exercise 5A to accept

Percentages2.java + 1 public class Percentages2 2 { 3 4 5 6 7 8 public static void main (String args[]) { double num1 = 2.0, num2 = 5.6; computePercent(numi, num2); computePercent (num2, num1); } public static void computePercent(double x, double y) { // Modify the code below System.out.println(x + is " + (x / y) * 100 + } 9 10 11 12 percent of " + y); 13 14 } 15

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!