COE 318 Quiz: COE318 – Fall 2014 Quiz-v2 (Solutions)

58 views5 pages

Document Summary

There will be three lines of output when we execute the main method of class ex3. Please provide those three lines of output. public class ex3 { public static void main(string[] args) { int i = 0; while(i < 3) { i++; System. out. print("p"); for(int j = 0; j < 2; j++){ Ex1 s = new ex1(11); s = p; p = q; q = null; r = p; Value of t: 2 p q r s. A capacitor with charge q, voltage v and capacitance c (whose value cannot change once initialized) is characterized with the equation (cid:1843)(cid:3404)(cid:1829)(cid:1848). Its energy, u, can be calculated with (cid:1847)(cid:3404)(cid:2869)(cid:2870)(cid:1843)(cid:1848). public class capacitor { //instance variables private double capacitance; private double voltage; public capacitor(double c) { capacitance = c; public double getcapacitance() { return capacitance; public double getvoltage() { //complete this method return voltage; public void setvoltage(double newvoltage) { //complete this method voltage = newvoltage; public double getcharge() {