Hi ive been given the task of programming code that solves a calculation of variable inputs from the Scanner, from f and n. I've got upto the stage of inputting the variables and it compiles in cmd but thats it... I dont know have a clue how to expand it and put the values of f and n into the equation.
gain = [275/(23^2+(0.5f)^2)^0.5]^n
I've to use a do-while loop whilst gain and f are to be declared as a double whilst n is an int. The answer should be printed out to 2 decimal places and the program should only break out of the loop when a valid value of n has been entered. n can only be from 1 to 10.
Example:
Enter a frequency:
100
Enter the number of stages:
0
Enter a value between 1 and 10 please try again.
Enter the number of stages:
6
gain = 15563.18
Heres where I've got up to>
I think the if and else statements are wrong these may need to be the do while loops Im not very confident with this 
gain = [275/(23^2+(0.5f)^2)^0.5]^n
I've to use a do-while loop whilst gain and f are to be declared as a double whilst n is an int. The answer should be printed out to 2 decimal places and the program should only break out of the loop when a valid value of n has been entered. n can only be from 1 to 10.
Example:
Enter a frequency:
100
Enter the number of stages:
0
Enter a value between 1 and 10 please try again.
Enter the number of stages:
6
gain = 15563.18
Heres where I've got up to>
Rich (BB code):
import java.util.Scanner;
public class Assignment1
{
public static void main (String [] args)
{
Scanner input = new Scanner(System.in);
System.out.print ("Please enter the frequency: ");
int frequency = input.nextInt ();
System.out.println (+ frequency);
System.out.print ("Please enter the number of stages:");
int stages = input.nextInt ();
if (stages >=1)
if (stages <=10)
{
System.out.println (+ stages);
}
else
{
System.out.println ("Enter a value between 1 and 10. PLease try again.");
}
}
}