Consider the following tuning circuit connected to an antenna, where C is a variable capacitor whose capacitance ranges from Cminmin to Cmaxmax. see image.
The tuning circuit selects the frequency f = 2π / √LC. To design this circuit for a given frequency, take c = √CminCmax and calculate the required inductance L from f and C. Now the circuit can be tuned to any frequency in the range fmin = 2π / √LCmax to fmax = 2π / √LCmin.
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.
Using the Design Recipe, write each of the following for this problem:
1.Contract
2.Purpose Statement
3.Examples, making sure to include counter-examples
4.Algorithm
Make sure to test your algorithm by hand (see Chapter 2, Section 2.4 in Big Java: Late Objects) with the examples to verify it before continuing to Part 2.
Using Eclipse, write the Java program for the algorithm formulated in Part 1, and test your program with the examples from Part 1. Make sure to incorporate your Contract, Purpose Statement and Examples as one or more comment blocks, and your Algorithm as line comments in your Java source code.