The circuit shown below illustrates some important aspects of the connection between a power company and one of its customers. The customer is represented by three parameters, Vt, P, and pf. Vt is the voltage accessed by plugging into a wall outlet. Customers depend on having a dependable value of Vt in order for their appliances to work properly. Accordingly, the power company regulates the value of Vt carefully. Pdescribes the amount of power used by the customer and is the primary factor in determining the customers electric bill. The power factor, pf, is less familiar. (The power factor is calculated as the cosine of an angle so that its value will always be between zero and one.) In this problem you will be asked to write a Java program to investigate the significance of the power factor. see image.
In the figure, the power lines are represented, somewhat simplistically, as resistances in Ohms. The power company is represented as an AC voltage source. The source voltage, Vs, required to provide the customer with power P at voltage Vt can be determined using the formula see image.
(Vs has units of Vrms.) This formula indicates that the value of Vs depends on the value of Vs.
Write a Java program that prompts the user for a power factor value and then prints a message giving the corresponding value of Vs, using the values for P, R, and Vt shown in the figure above.
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.