Reference no: EM131270834
The Power function calculates the power of a base "a" raised to an exponent "n". Write a class which that you will call Power class with a method "power(a,n)" that prints the corresponding power value. Remember to use "float" for a and "long" for n and the returned value to be a "float" because the number is ***** real number.
Design and write a Dialog box for Input/Ouput that allows the users to input a base "a" and an exponent "n" and outputs the result of the power of a raised to the exponent of n.
Example:
Power(5.0,2)=(5.0)2= 25.0
Power(5.0,-2)=(5.0)-2 = (1/25)=0.04
Remember the values of n can be postive or negative. Your code should be able to deal with both cases. Remember to limit the value of n to the value 40 maximum.
The Assigment will require you to create 2 files:
1- Power.java which contain the details of creating the Power class and the method power which should calculate the power of any number a raised to the exponent n. (Use the Discussion 'Hints on Assign6" for help with writing the code for Power.java as an example). Remember that you are to create 2 loops in the "power(a,n)" method that you need to write: one loop for n>0 and one loop for n0. You need to cover both >0 and <0.
class Power{
float power (float x,long n){
float pow=1;
for(int i=0;i<n;++i)
pow=pow*x;
return pow;
}
}
How is sales territory similar to entrepreneurial venture
: How is a sales territory similar to an entrepreneurial venture? If a salesperson views his or her territory as an entrepreneurial venture, how might this change the way in which he or she approaches the management of the territory?
|
Compare manual operations
: Describe the topic and specify what you learned from the video Explain the pros and cons of this approach Compare manual operations vs. the new computer-aided technology Find at least two additional references to support your paper
|
Evaluate the existing compensation plan
: Evaluate the existing compensation plan to determine if it is the most appropriate for your company. Explain your rationale. Determine the most beneficial ratio of internally consistent and market consistent compensations systems for the company you..
|
About employee work-life balance
: Do you think it's even important for a business to care about employee's work-life balance? How might this be evidenced in the “real world”? Can you provide some examples from your experiences?
|
Calculate the power of any number a raised to the exponent n
: Power.java which contain the details of creating the Power class and the method power which should calculate the power of any number a raised to the exponent n.
|
Perform the pert-cpm calculations first
: You will have to perform the PERT/CPM calculations first. Assume the total number of identical, full-time Type 1 resources available initially = 10, and Type 2 resources initially.
|
Human resources department of large company
: If you were in the human resources department of a large company and needed to fill 10 entry-level positions working in a warehouse, and 2 management positions for the company, what selection tools would you choose for each and why? Choose at least t..
|
The program shall test to ensure that there is a punched in
: The program shall test to ensure that there is a ‘Punched in' record for the corresponding day before a ‘punched out' record is saved. If none is found, prompt the user to enter a ‘punched in' time.
|
Benefits to family members of delivering hand massage
: Benefits to Family Members of Delivering Hand Massage with Essential Oils to Critically Ill Patients Article. Which of these statements best describes this study’s research framework? This study has an implicit framework, which is not fully developed..
|