SHARE
TWEET

WOW WTF??? MUST REVIEW CODE. INTERESTING

cynthiarez Sep 17th, 2019 (edited) 117 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int months, counter = 1 ;
  2.         String str = "", str2;
  3.         double bills;
  4.         double bills2=0;
  5.         double total = 0, ave = 0;
  6.        
  7.         months = Integer.parseInt(JOptionPane.showInputDialog("Enter number of months of electricty bill"));
  8.        
  9.         while (counter<=months)
  10.         {
  11.            
  12.            
  13.             bills = Double.parseDouble(JOptionPane.showInputDialog("Enter electricity bill for the month " + counter));
  14.             bills2 = bills + bills2;
  15.            
  16.             str += str2 = "Month: " + counter+ " = " + bills + "\n";
  17.             counter++;
  18.  
  19.         }
  20.        
  21.         ave = bills2/counter;
  22.         JOptionPane.showMessageDialog(null, str + "\n The total electricity bill is " + String.format("%.2f", bills2) + "\n The average is " + String.format("%.2f", ave));
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top