homework_8 - ECE 1574 Homework Set #8 Problem Solving with...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
ECE 1574 Homework Set #8 Problem Solving with C++ Due date: 3/21/10 by 11:55 p.m. This assignment is to be done individually Complete the lab exercise and answer questions 1 and 2 during the lab session. Answer the other questions later. LAB EXERCISE Consider the electrical circuit shown. ------2 ohms---- ----3 ohms----- | | | | | | | | --- ---- ---- | | | | | | | | | | | | | ------4 ohms---- -----5 ohms---- | | | 100 volts 10 - 20 ohms | | | | ___ ___ - - In the circuit, there are a 100-volt DC source, a 2-ohm resistor in parallel with a 4-ohm resistor, and then a 3-ohm resistor in parallel with a 5-ohm resistor. The circuit is terminated in a load whose value varies randomly logarithmically, as in last week’s lab, between 10 and 20 ohms. Run a Monte Carlo simulation, estimating the expected (that is, the average) current through each of the five resistors. REQUIREMENTS 1. Write a function called parallel_resistance() which takes two resistances as arguments and returns their combined resistance in parallel. 2. Write a function called series_resistance() which takes two resistances as arguments and returns their combined resistance in series. 3. Stage the two functions together in a namespace called Resistance_Addition, presented in a header Resistance_Addition.h and coded in a program-source file Resistance_Addition.cpp. Expose these functions in your program’s main . cpp file by an
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
appropriate #include and use them there wherever parallel or series addition of resistances is needed. 4. Give using statements in your . cpp files as seems advisable to you, but (a) do not give any using statements in your header ( using statements in a header are usually a bad idea, because they apply not only to the header itself but also, indiscriminately, to every program-source file in which the header is #included ) and (b) do not issue a using namespace directive anywhere in your program, for any reason (that is, don’t dump your namespaces: you may write “using std::cout;” and the like, but do not write “using
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/15/2011 for the course ECE 1574 taught by Professor Rpbroadwater during the Spring '08 term at Virginia Tech.

Page1 / 6

homework_8 - ECE 1574 Homework Set #8 Problem Solving with...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online