The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 430 Weeks Ago, 5 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
Create an application named Percentages whose main() method holds two double variables. Assign values to the variables. Pass both variales to a method named computePercent() that displays the two values and the value of the first number as a percentage of the second one. Then call the method a second time, passing the values inreverse order. Save as Percentages.java
I'm prety much done, I just need this modified to NOT prompt the user for any information. Thank you
public class Percentages {
public static void main(String[] args) {
String inputNumber;
double number1;
double number2;
inputNumber = JOptionPane.showInputDialog(null,"Plese enter the first number");
number1 = Double.parseDouble(inputNumber);
inputNumber = JOptionPane.showInputDialog(null,"Plese enter the second number");
number2 = Double.parseDouble(inputNumber);
computePercent(number1,number2);
computePercent(number2,number1);
}
public static void computePercent(double num1, double num2)
{
JOptionPane.showMessageDialog(null,num1 + " is " + num1/num2*100 + "% of " + num2);
}
}
Thank you
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll