Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with part B for this lab completed below is the starter code given to help us: // Ohms law structure assignment -

I need help with part B for this lab completed below is the starter code given to help us:

// Ohms law structure assignment - part a starter code
//
// This code solves the basic case of one resistor and one voltage source
//
// Please convert this starter code to use functions as much as possible
// It will become part A of the laboratory
//
// You need to create at least 5-functions
#include iostream>
#include string>
#include vector>
using namespace std;
// You must use this structure
struct node {
string name;
double resistance;
double voltage_across;
double power_across;
};
// An Example of the type of function you may want to create
string nodeName() {
string node_name;
cout "Enter Node Name: ";
cin >> node_name;
return node_name;
}
//
// The comments indicate good places to covvert code to short functions
//
int main() {
node N1;
// Enter source voltage
double source_voltage;
cout "Enter Source Voltage: ";
cin >> source_voltage;
// Enter basic Node Information
N1.name = nodeName();
cout "Resistor Value: ";
cin >> N1.resistance;
// Calculate series current for the one-node network
double total_resistance = N1.resistance;
double series_current = source_voltage/ total_resistance;
// Calculate voltage across the restistor
N1.voltage_across = series_current * N1.resistance;
// Calculate the power across the resistor
N1.power_across = N1.voltage_across * series_current;
// Display Network Information
cout "Series Network: "
cout "Source Voltage: " "-Volts"
cout "Total Resistance: " "-Ohms"
cout "Series Current: " "-Amperes"
// Display Node information
cout "Node Name: " name
cout "Node Voltage: " voltage_across "-Volts"
cout "Node Resistance: " resistance "-Ohms"
cout "Node Power: " power_across "-Watts"
return 0;
}image text in transcribedimage text in transcribedimage text in transcribed

Obiective: To create a series DC circuit solver that involves voltage, current, resistance, and power. It will use Ohm's law to determine the voltage, power, and current through individual resistors Laboratorv Checklist: Review Ohm's law. See last page in the document . Review C++ Functions o Review C++ Vector class Read Problem Specification Download the starter code Please create and implement a simple series circuit solver for one resistor. Use the filename of ohms-part-a.cpp for GITHUB.UC.EDU submission. Please create and implement a series circuit solver that can take an "unlimited" number of resistors by utilizing the C++ "vector" class. Use the filename of ohms-part-b.cpp for GITHUB.UC.EDU submission Parts B needs to be checked by Teaching assistant or instructor during your assigned laboratory session Please add a menu to your series circuit solver to allow for deleting nodes (resistors) in your circuit, display the calculated results, allow for adding nodes (resistors) to your circuit, and changing input voltage. Use the filename of ohms-part-c.cpp for GITHUB.UC.EDU submission When complete push assignment related files to GITHUB under lab folder containing ohms-part-a.cpp, ohms-part-b.cpp and ohms-part-c.cpp . . Specification This assignment is divided into three parts one is a simple implementation of a series DC circuit (a voltage source, resistance, and current plus power calculation). Part B will use the vector class to "unlimit" the number of resistors in the circuit. Part C is to create an edit menu so you can make changes to vour circuit Please use this structure to store the information related to each node in your series DC network

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems A Practical Approach To Design Implementation And Management

Authors: THOMAS CONNOLLY

6th Edition

9353438918, 978-9353438913

More Books

Students also viewed these Databases questions

Question

What is the role of communication (Chapter 4) in leadership?

Answered: 1 week ago