A community for students.
Here's the question you clicked on:
 0 viewing
pottersheep
 5 years ago
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
pottersheep
 5 years ago
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

This Question is Closed

pottersheep
 5 years ago
Best ResponseYou've already chosen the best response.0This is what I did (fail)

pottersheep
 5 years ago
Best ResponseYou've already chosen the best response.0import 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
 5 years ago
Best ResponseYou've already chosen the best response.0can I use a loop in my method ? please help........

pottersheep
 5 years ago
Best ResponseYou've already chosen the best response.0i think my return part is wrong but idk how to do it

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0please format your code and put it to pastebin.com or codepad.org or somewhere else

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0http://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
 5 years ago
Best ResponseYou've already chosen the best response.0Ok here it is http://pastebin.com/AMiaBFDR

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0well you didn't change it at all
Ask your own question
Sign UpFind more explanations on OpenStudy
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.