c. Engineering Application: Electric Field for an Insulating Sphere of Charge Use filename: efield.cpp In Semiconductor Physics you will learn that Gauss' Law requires that an electric field exists whenever there is net electric charge in a region of space or in a material such as a perfect insulator. Figure 1 shows the arrangement for an insulating sphere that contains a total charge, Q coulombs, that is uniformly distributed within the sphere. E Figure 1 - Electric Field for Charged Insulating Sphere The magnitude of the electric field (N/C) at any radial distance from the center of the sphere is given by: E(r) = keQ· r< a a3' keQ r2 r > a Some requirements and recommendations for your program include: • Hardcode the following parameters as constant global variables of type double &: o Q = 10-9 C(oulomb) o ke = 9x10° (N – m²)/C² o rmin = e o rmax = 100 • In main(), set up a loop that spans all values of r in the range [rmin 100m] in increments of 1m. For each loop iteration, make a Om, rmax call to the function Efield(.) and pass in a specific radial location. The function prototype is given by %3D

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

C++ Programming

ЕЕСЕ1080C/CS1021C
Lab Functions 2
Topics covered: C++ Program Development Practice, Loops, Functions and Arrays
- Parameter 'a' is given a default value = 5@m. This can
can be overridden in the actual function cal1 (a < rmax)
- Function returns type double which is computed value of E(r)
********/
double Efield(double r, const double &a = 50);
• The total number of loop iterations (n) is given by
int n = static_cast<int>(rmax) - static_cast<int>(rmin) + 1; |/ downcast
Output the values to your terminal.
Output should look something like:
Total Charge in Sphere, Q = le-9 C
Radius of Sphere, a = 50 m
E, N/C
E(0) value
E(1) value
E(2) value
E(3) value
m
1
100
E(100) value
TESTING -
• Verify that the outputted values for the E-field are continuous at r = a
• Form the ratio of the E-field values at two radial positions, ri and r2
where ri < a and r2 > a. Confirm that E1/E2 = r}ri/a
DELIVERABLES FOR GRADING - This lab element will be auto-graded in zyBooks.
Copy and paste the contents of your Efield(..) function into the main.cpp
Window for zylabs using link provided on CANVAS site for lab (do not copy
your main() function into the window).
Transcribed Image Text:ЕЕСЕ1080C/CS1021C Lab Functions 2 Topics covered: C++ Program Development Practice, Loops, Functions and Arrays - Parameter 'a' is given a default value = 5@m. This can can be overridden in the actual function cal1 (a < rmax) - Function returns type double which is computed value of E(r) ********/ double Efield(double r, const double &a = 50); • The total number of loop iterations (n) is given by int n = static_cast<int>(rmax) - static_cast<int>(rmin) + 1; |/ downcast Output the values to your terminal. Output should look something like: Total Charge in Sphere, Q = le-9 C Radius of Sphere, a = 50 m E, N/C E(0) value E(1) value E(2) value E(3) value m 1 100 E(100) value TESTING - • Verify that the outputted values for the E-field are continuous at r = a • Form the ratio of the E-field values at two radial positions, ri and r2 where ri < a and r2 > a. Confirm that E1/E2 = r}ri/a DELIVERABLES FOR GRADING - This lab element will be auto-graded in zyBooks. Copy and paste the contents of your Efield(..) function into the main.cpp Window for zylabs using link provided on CANVAS site for lab (do not copy your main() function into the window).
EECE1080C/CS1021C
Lab Functions 2
Topics covered: C++ Program Development Practice, Loops, Functions and Arrays
c. Engineering Application: Electric Field for an Insulating Sphere of
Charge
Use filename: efield.cpp
In Semiconductor Physics you will learn that Gauss' Law requires that an
electric field exists whenever there is net electric charge in a region of
space or in a material such as a perfect insulator. Figure 1 shows the
arrangement for an insulating sphere that contains a total charge, Q
coulombs, that is uniformly distributed within the sphere.
Figure 1 - Electric Field for Charged Insulating Sphere
The magnitude of the electric field (N/C) at any radial distance from the
center of the sphere is given by:
E(r) = kel'
keë
r< a
%3D
r z a
r2
Some requirements and recommendations for your program include:
• Hardcode the following parameters as constant global variables of type
double &:
o Q = 10-9 C(oulomb)
o ke = 9x10° (N – m²)/C²
rmin = 0
%3D
rmax = 100
• In main(), set up a loop that spans all values of r in the range [rmin =
Om, rmax = 100m] in increments of 1m. For each loop iteration, make a
call to the function Efield(.) and pass in a specific radial location.
The function prototype is given by
/***
Transcribed Image Text:EECE1080C/CS1021C Lab Functions 2 Topics covered: C++ Program Development Practice, Loops, Functions and Arrays c. Engineering Application: Electric Field for an Insulating Sphere of Charge Use filename: efield.cpp In Semiconductor Physics you will learn that Gauss' Law requires that an electric field exists whenever there is net electric charge in a region of space or in a material such as a perfect insulator. Figure 1 shows the arrangement for an insulating sphere that contains a total charge, Q coulombs, that is uniformly distributed within the sphere. Figure 1 - Electric Field for Charged Insulating Sphere The magnitude of the electric field (N/C) at any radial distance from the center of the sphere is given by: E(r) = kel' keë r< a %3D r z a r2 Some requirements and recommendations for your program include: • Hardcode the following parameters as constant global variables of type double &: o Q = 10-9 C(oulomb) o ke = 9x10° (N – m²)/C² rmin = 0 %3D rmax = 100 • In main(), set up a loop that spans all values of r in the range [rmin = Om, rmax = 100m] in increments of 1m. For each loop iteration, make a call to the function Efield(.) and pass in a specific radial location. The function prototype is given by /***
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY