Consider the following tuning circuit connected to an antenna, where C is a vari
ID: 3889419 • Letter: C
Question
Consider the following tuning circuit connected to an antenna, where C is a variable capacitor whose capacitance ranges from Cmin to Cmax.
Write a Java program to design a tuning circuit for a given frequency, using a variable capacitor with given values for Cmin and Cmax. (A typical input is f = 16.7 MHz, Cmin = 14 pF, and Cmax = 365 pF.) The program should read in f (in Hz), Cmin and Cmax (in F), and print the required inductance value and the range of frequencies to which the circuit can be tuned by varying the capacitance.
AntennaExplanation / Answer
import java.awt.Rectangle;
2
3 public class MoveTester
4 {
5 public static void main(String[] args)
6 {
7 Rectangle box = new Rectangle(5, 10, 20, 30);
8
9 // Move the rectangle
10 box.translate(15, 25);
11
12 // Print information about the moved rectangle
13 System.out.print("x: ");
14 System.out.println(box.getX());
15 System.out.println("Expected: 20");
16
17 System.out.print("y: ");
18 System.out.println(box.getY());
19 System.out.println("Expected: 35");
}
}
public static void main(String[] args)
{
JFrame frame = new JFrame();
frame.setSize(300, 400);
frame.setTitle("An empty frame");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}