Answered step by step
Verified Expert Solution
Question
1 Approved Answer
package amplifiersapp; import java.util.ArrayList; public class AmplifiersApp { / * * * @param args * / public static void main ( String [ ] args
package amplifiersapp;
import java.util.ArrayList;
public class AmplifiersApp
@param args
public static void mainString args
double r;
double r;
ArrayList amplifiers new ArrayList;
amplifiers.addnew InvertingAmplifierr r;
amplifiers.addnew NoninvertingAmplifierr r;
amplifiers.addnew VdivAmplifierr r;
for int i ; i amplifiers.size; i
System.out.printlnamplifiersgetigetDescription
"Gain: amplifiers.getigetGain;
public abstract class Amplifier
double R R;
public Amplifierdouble R double R
this.R R;
this.R R;
public abstract String getDescription;
public abstract double getGain;
public class VdivAmplifier extends Amplifier
public VdivAmplifierdouble R double R
superR R;
@Override
public String getDescription
return "Vdiv Aplifiers: R R R R;
@Override
public double getGain
return RRR;
public class NoninvertingAmplifier extends Amplifier
public NoninvertingAmplifierdouble R double R
superR R;
@Override
public String getDescription
return "Noninverting Aplifiers: R R R R;
@Override
public double getGain
return RR;
public class InvertingAmplifier extends Amplifier
public InvertingAmplifierdouble R double R
superR R;
@Override
public String getDescription
return "Inverting Aplifiers: R R R R;
@Override
public double getGain
return RR;
I am getting this error error: nonstatic variable this cannot be referenced from a static context
amplifiers.addnew InvertingAmplifierr r;
Also public static void mainString args
double r;
double r;
ArrayList amplifiers new ArrayList;
amplifiers.addnew InvertingAmplifierr r;
amplifiers.addnew NoninvertingAmplifierr r;
amplifiers.addnew VdivAmplifierr r;
for int i ; i amplifiers.size; i
System.out.printlnamplifiersgetigetDescription
"Gain: amplifiers.getigetGain;
this needs to be unchanged
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started