return O HAND IN LABORATORY TASK: LAB #4 Electrostatic force on two charges F-k0
ID: 3746932 • Letter: R
Question
return O HAND IN LABORATORY TASK: LAB #4 Electrostatic force on two charges F-k0102/r2 k- 9x 109 Newtons meter 2/Coulomb2 constant Current values of known variables follow 01-2X106 Coulombs Q2 = 1.5 x 10-6 Coulombs F-0.5 Newtons r-? Meters setup solution as an equation r- And have the computer solve it. Put your name ,date and LAB#4 ast start! Use descriptive names for variables not physics abbreviations as above and e scientific notation for constants and values. Output r with units Use a string variable to hold the unit "meter" Remember for full credit comments to yourself and for the user to know what is being done and the output WARNING: Identical copies of lab work results in a O for all and even the original!Explanation / Answer
PROGRAM
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
double F,k,Q1,Q2,r; // declare double variables
k=9e9; // 9 x 10^9
Q1=2e-6; // 2 x 10^-6 point charge
Q2=1.5e-6; // 1.5 x 10^-6 point charge
F=0.5; // Force
// display constant values
cout<<"Coulomb Constant k: 9 x 10^9"<<endl;
cout<<"Point Charge-1 Q1: 2 x 10^-6"<<endl;
cout<<"Point Charge-2 Q2: 1.5 x 10^-6"<<endl;
cout<<"Electrostatic Force F: "<<F<<endl;
r=sqrt((k*Q1*Q2)/F); // calculate distance sqrt((k*Q1*Q2)/F)
cout<<"Distance r= "<<r<<" Meters"; // calculate Distance
return 0;
}
OUTPUT
Coulomb Constant k: 9 x 10^9
Point Charge-1 Q1: 2 x 10^-6
Point Charge-2 Q2: 1.5 x 10^-6
Electrostatic Force F: 0.5
Distance r= 0.232379 Meters
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.