Please let me know if you have any doubts or you want me to modify
the answer. And if you find this answer useful then don't forget to
rate my answer as thumps up. Thank you! :)
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
using namespace std;
double totalResistance(string);
int main()
{
int choice;
string formula;
cout << "*** Welcome to Total
Resistance Calculator Program ***" << endl;
cout << "1. Enter circuit formula."
<< endl;
cout << "2. Generate circuit randomly."
<< endl;
cout << "3. Show circuit formula."
<< endl;
cout << "4. Calculate total resistance."
<< endl;
while (choice !=-1)
{
cout << "Your
choice (1-4) : ";
cin >>
choice;
switch(choice)
{
case 1:
cout << "Enter circuit formula: ";
cin >> formula;
break;
case 3:
cout << "Circuit formula is " << formula <<
endl;
break;
case 4:
cout << "Circuit total resistance is " <<
totalResistance(formula) << " ohm" << endl ;
break;
}
}
}
double totalResistance (string tempFormula)
{
double total=0;
double value[8];
char valueOperator[8];
stringstream assignation(tempFormula);
for(int i=0; i<4; i++)
{
assignation >>
value[i];
assignation >>
valueOperator[i];
}
//need to create word counter, and randomize case
for(int i=0; i<4; i++)
{
if(valueOperator[i]==
'/')
{
total += ((value[i]*value[i+1])/(value[i]+value[i+1]));
i++;
}
else
if(valueOperator[i]== '+')
total += value[i];
else if(i==3)
total += value[i];
}
return total;
}
Using C++ For a given electrical circuit, composed from a network ofresistors, arranged in parallel and/or...
Using Matlab When several resistors are connected in an electrical circuit in parallel, the current through each of them is given by in=vs/Rnwhere in and Rn are the current through resistor n and its resistance, respectively, and vs is the source voltage. The equivalent resistance, Req, can be determined from the equation 1/Req=1/R1+1/R2+1/R3+.......+1/Rn. The source current is given by is , and the power, Pn, dissipated in each resistor is given by . is=vs/Req, and Pn=vsin. Write a program in...
Problem: Design and write a C language program that can be used to calculate Voltage, Current and Total Resistance for a Series or Parallel or a Series Parallel circuit. The program should display the main menu that contains the three types of circuit calculations that are available and then the user will be prompted to select a circuit first. After the circuit has been selected the program should then display another menu (i.e., a submenu) requesting the necessary data for...
Design program so that it correctly meets the program specifications given below. Specifications: Create a menu-driven program that finds and displays areas of 3 different objects. The menu should have the following 4 choices: 1 -- square 2 -- circle 3 -- right triangle 4 -- quit If the user selects choice 1, the program should find the area of a square. If the user selects choice 2, the program should find the area of a circle. If the user...
THIS IS FOR C++ PROGRAMMING USING VISUAL STUDIO THE PROGRAM NEEDS TO BE IN C++ PROGRAMMING #include "pch.h" #include #include using namespace std; // Function prototype void displayMessage(void); void totalFees(void); double calculateFees(int); double calculateFees(int bags) { return bags * 30.0; } void displayMessage(void) { cout << "This program calculates the total amount of checked bag fees." << endl; } void totalFees() { double bags = 0; cout << "Enter the amount of checked bags you have." << endl; cout <<...
ELT 103 Final Exam Spring 2019 1. A series-parallel circuit is: a. typically combination of series banks and parallel strings c always a combination of series banks in parallel e. always a combination of parallel banks in series. d. usually a combination of series strings and parallel banks. 2. When analyzing resistance in a series-parallel circuit, you start: a. anywhere in the circuit. / b. at the source. c. at the farthest resistor from the source. d. in any parallel...
C++ programming For this assignment, write a program that will act as a geometry calculator. The program will be menu-driven and should continue to execute as long as the user wants to continue. Basic Program Logic The program should start by displaying a menu similar to the following: Geometry Calculator 1. Calculate the area of a circle 2. Calculate the area of a triangle 3. Quit Enter your choice(1-3): and get the user's choice as an integer. After the choice...
A) Given An AC circuit in the frequency domain has an impedance Z represented by the vectors E and I 40v 16.87 60 hertz 20° 8.0A B) Determine Step 1: The value of the impedance Z as a complex number in rectangular form. Step 2: The sketch of Z in terms of an equivalent series circuit representation. Step 3: The value of the reactive element of the series equivalent circuit representation Step 4: The value of the admittance Y -...
Plz give me correct code and screen shots for this question by using SASM !!!!!!!! Implement the following working C++ program in assembler. Submit assembler code and screen shot. #include <iostream> #include <iomanip> using namespace std; // This menu-driven Health Club membership program carries out the // appropriate actions based on the menu choice entered. A do-while loop // allows the program to repeat until the user selects menu choice 4. int main() { // Constants for membership rates const...
Using C++ programming Write a program that compares a student’s answers in a 5-question quiz to the teacher’s answer key. The answer key is: {'C', 'D', 'B', 'B', 'A'} You MUST use TWO functions: One for input and the other for comparing/output. The output is simply the # of questions answered correctly. This program will test your ability to handle parallel arrays. Output: Look at the questions and choices on page 999 of your textbook. Enter the UPPERCASE letter of...
Please, I need help, I cannot figure out how to scan variables in to the function prototypes! ******This is what the program should look like as it runs but I cannot figure out how to successfully build the code to do such.****** My code: #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <math.h> #include <conio.h> float computeSeriesResistance(float R1, float R2, float R3); float computeParallelResistance(float R1, float R2, float R3); float computeVoltage(int current, float resistance); void getInputR(float R1, float R2, float R3); void getInputCandR(int...