Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Some helpful notes for the Project You may use Java Collection Framework or STL

ID: 3908993 • Letter: S

Question

Some helpful notes for the Project

You may use Java Collection Framework or STL of C++ to design an appropriate data structure for the class Circuit. If you want to do it from the basic data structures, the following suggestions are helpful but not enough to describe the required data structure:

Label the lines of the circuit( all internal and external lines) using an array L[]. The value of an array item is either 0, 1, or 2; 2 indicates the value of the line is unknown.

Label the gates and flip-flops and define an array G[] of objects of type Component. The class Component describes the type of the gate or flip-flop and the labels of the input and output lines of the component. You will need to define several methods for the class Component, for example get the number of the input lines , get the number of output lines, get the labels and values of input lines, and so forth.

You will need three integers say n, m, and k. One for # of input lines of the circuit, the second for the number of output lines of the circuit, and the third one for the number of state lines( flip-flops outputs) of the circuit.

So you need at least two classes Circuit and Component. The class Component describes a gate or flip-flop, its input lines, output lines, and its operation. The class Circuit describes a logical (combinational or sequential) circuit as a collection or an array of Component plus other data: the number of input lines, number of output lines, and number of flip-flops.

Explanation / Answer

Hi, i don't know for what purpuse you need this but this is the code according to your assignment.

#include <iostream>
using namespace std;

class component
{
private:

int GateOrFlipFlop; // 0 for gate , 1 for flipflop
int inputLine; // input line  
int outputLine; // output line 0, 1, or 2; 2 indicates the value of the line is unknown.
int operation;

public:
component()
{
GateOrFlipFlop = 0;
inputLine = 0 ;
outputLine = 0;
operation = 0;
}
component(int GateOrFlipFlop_a, int inputLine_a, int outputLine_a, int operation_a)
{
GateOrFlipFlop = GateOrFlipFlop_a;
inputLine = inputLine_a ;
outputLine = outputLine_a;
operation = operation_a;
}
int getinputLineValue(void)
{
return inputLine;
}
int getoutputLineValue(void)
{
return outputLine;
}
int getOperation(void)
{
return operation;
}

};
class circuit
{
public:
int logiOrSeq;
component G[100];
int n,m,k; // n-number of inputline, m-number of output lines, k-number of state lines
//constructures
circuit()
{
n = 0;
m=0;
k=0;
logiOrSeq = 0;
}
circuit(int n_a , int m_a, int k_a, int logiOrSeq_a)
{
n = n_a;
m=m_a;
k=k_a;
logiOrSeq = logiOrSeq_a;
}
//getter functions
int getIpLines(void)
{
return n;
}
int getOpLines(void)
{
return m;
}

int getNumOfFlipFlops()
{
return k;
}
int getLogi()
{
return logiOrSeq;
}

};


int main()
{


}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote