pottersheep
  • pottersheep
Guidance please !! Write a method to calculates exponents. Pass 2 values: the number and the exponent it is to be calculated to; return the result. Display the returned value
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
schrodinger
  • schrodinger
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
pottersheep
  • pottersheep
This is what I did (fail)
pottersheep
  • pottersheep
import java.util.Scanner; public class exponentmethod { public static void main (String args []){ Scanner input = new Scanner (System.in); int total = 0 , first = 0 , second = 0 ; System.out.print("Enter base"); first= input.nextInt(); System.out.print("Enter exponent"); second= input.nextInt(); total= a(first, second); System.out.print("result"+total); } static int result=1; static int a(int t,int y){ return result; int ctr=1; while (ctr!=y){ result = result * t; ++ctr; } } }
pottersheep
  • pottersheep
can I use a loop in my method ? please help........

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

pottersheep
  • pottersheep
i think my return part is wrong but idk how to do it
anonymous
  • anonymous
please format your code and put it to pastebin.com or codepad.org or somewhere else
anonymous
  • anonymous
http://pastebin.com/n2uTQdib as i commented about spaces near = it's not essential but it's good practise and you will follow java coding conventions
pottersheep
  • pottersheep
Ok here it is http://pastebin.com/AMiaBFDR
anonymous
  • anonymous
well you didn't change it at all

Looking for something else?

Not the answer you are looking for? Search for more explanations.