Electro-magnetic force in newtons

Assignment Help Programming Languages
Reference no: EM13760323

The topic of this assignment was chosen so that you won't allow mathematical equations and scientific notation to intimidate you. No knowledge is required to complete the assignment beyond knowing how to perform mathematical operations within a formula.

NOTE: Use the double precision data type for all floating point variables in these programs (instead of the single precision float data type).

Program #1

Electro-magnetic force describes the influence that one electrical charge has on another when neither charge is moving.

The equation for this electro-magnetic force in Newtons is: , where the constant and where: π is the constant Pi, whose value to 10 decimal places is 3.1415926535

E0 is a constant known as the permittivity of free space with value = 8.854 x 10-12 coulombs2 per Newton meters2 q1 and q2 represent the charges of two objects in coulombs r represents the distance between the centers of the objects in meters K is Coulomb's constant, in Newton meters2 Coulombs-2

For the Curious: Electrical charges can either attract or repel each other, as q1 and q2 may be either positive or negative. When the have same signs, they repel each other. When they have opposite signs, they attract each other.

Program Requirements: Write a program to compute the electro-magnetic force between 2 charged objects. The program shall: ? Define a constant, using scientific notation, for the permittivity of free space. ? Define another constant, using fixed notation, for Pi carried out to 10 decimal places.

Use a separate, user-defined function to output the program description header to the user before prompting for input. This header should contain your name. For example:

Read user input NOTE: You are not required to validate any of the user input. You may assume that the user will enter a valid answer for each question.

o Read the charges of two objects, as input from the user. o Read the distance between the centers of the two objects, as input from the user.

Calculate the electro-magnetic force between the objects. Display several blank lines after reading all the inputs, before displaying the results.

Displays all data using the format given in the following sample output, which meet the following specifications: The charges of both objects, and the distance between the objects, are displayed first, in fixed format, carried out to 3 decimal places. Their decimals should all line up.

The permittivity of free space, the calculated Coulomb's constant, and the calculated electro-magnetic force are 1ll displayed in scientific format, carried out to 4 decimal places. Their decimals should line up.

All unit descriptions also line up.

Additionally, the program must: Compile without errors, Include appropriate mnemonic constant and variable declarations, Prompt the user for data in a meaningful way, Adhere to the documentation standards for this course (see course Content section 1.8)

(see sample input/output on next page)

Calculation of Electro-magnetic Force between two Objects By Mr. YOUR NAME

Sample Input and Output:

Notes: This output example provides convenient test data that can be used to verify the calculations in your program.

The representation of the following number uses scientific notation: o 8.854 x 10-12 is the same as 0.000000000008854, and is represented in C++ scientific notation as 8.854E-12. o The minus sign in 8.854E-12 indicates a negative exponent (i.e. a fraction). o By default, the exponent in scientific notation is displayed using 3 digits, like this: 8.854E-012. o The number of digits in the scientific notation can be changed via the setprecision output manipulator (i.e. the same method as fixed notation). ? Users can also input values at the keyboard using scientific notation

(see next page for program 2 requirements)

Calculation of Electro-magnetic Force between two Charged Objects By Mr. YOUR NAME

Enter charge of object 1 (in coulombs): 1.1 Enter charge of object 2 (in coulombs): 2.2

Enter distance between the centers of the two objects (in meters): 10

RESULTS:

Charge of first object: 1.100 coulombs Charge of second object: 2.200 coulombs Distance between objects 10.000 meters
Permittivity of Free Space: 8.8540e-012 coulombs^2 per Newton meters^2 Coulomb's Constant: 8.9877e+009 Newton meters^2 Coulombs^-2

Electromagnetic Force: 2.1750e+008 Newtons

Program #2

A right circular cone has a circular base, and the line from the center of the base to the tip of the cone forms a right angle with the base.

If you know the height (h) of a cone and the radius (r) of the base of the cone, then you can calculate the slant height (s), surface area (a), and volume (v) of the cone using the following formulas.

Slant Height: s = √ Surface Area: A =

Volume: v =

Note that the slant height is the hypotenuse of the right triangle, whose other two sides are the height and the radius of the base.
Again, don't let the equations intimidate you. These formulas simply perform addition, multiplication, division, squaring, and finding a square root.

Requirements:

Write a program that will: Display a program description to the user before asking for any input. Defines a constant for PI, using fixed notation, carried out to 5 decimal places (value for Pi was given in program 1). Read the radius of the base of a right circular cone, as input from the user. Read the height of a right circular cone, as input from the user. Calculate the square of the radius, and store its value in a variable. (This value is used in all of the formulas. Use the stored value in all the formulas.) o Use the pre-defined pow function from the cmath library for squaring. Calculate the slant height of the right circular cone, using the above formula. o Use the pre-defined sqrt function from the cmath library to implement this calculation. Calculate the surface area of the right circular cone, using the above formula. Calculate the volume of the right circular cone, using the above formula. From the main function, display a few blank lines, and then a RESULTS header. From the main function, display the base radius and height of the right circular cone, rounded to 2 decimal places as shown in the sample output. The decimals of both values should line up. Write and call a separate, user-defined function to output the calculation results: o The function should have thee input parameters: slant height, surface area, and volume o From within the user-defined function, display surface area, slant height, and volume of the right circular cone formatted as shown below, each rounded to 2 decimal places. The decimals of the three values should line up, and also line up with the input values displayed from main. o No calculations should be performed from within this function.

Sample Input and Output

Documentation

1) Comment any constants/variables whose names are not completely descriptive.

Program for Right Circular Cone calculations

Enter cone radius (in inches): 5.5 Enter cone height (in inches): 10

RESULTS: For a Right Circular Cone with Radius of 5.50 inches Height of 10.00 inches Cone Slant Height is 11.41 inches Cone Surface Area is 292.23 square inches Cone Volume is 316.78 cubic inches

2) Be sure to include top of program comments as specified in course Content section 1.8: Your name, the course, and the assignment number What the Program Does including: What is Input Processing Performed What is Output

3) You must also include a comment above each user-defined function that includes: What the function does The name and a description of any parameters that are input to the function

4)For readability, make sure you have: - a SPACE before and after each operator (+, -, *, /, =) - a SPACE after each comma in your code - blank lines between sections of your code

5) Remember that dividing one integer by another integer will produce an integer result. Example: 1 / 3 = 0 So if you want floating point results, be sure that one of the operands is a floating point value. Example: 1 / 3.0 = 0.3333...

Submission

This programming assignment is due by midnight Monday. Submit your program source code (both of the .cpp files) to the Prog Assn 2 dropbox (located under the Dropbox tab in the online course). Both files should be attached to one submission for programming assignment 2.

Before submitting your program files, you MUST name them as follows: Lastname-wk2-prog1.cpp Lastname-wk2-prog2.cpp

For example: Smith-wk2-prog1.cpp Smith-wk2-prog2.cpp

Reference no: EM13760323

Questions Cloud

Audit professional organizations : Visit a Web site for one of the audit professional organizations.
Breadth and depth of knowledge : The breadth and depth of knowledge required to audit IT and systems are extensive and may include
How do children in us fare in terms of critical issues : How do children in the United States fare in terms of the critical issues of poor health and hygiene, poverty, and malnutrition? Why is supporting each of these basic needs such a difficult challenge
Create the css for a website : Create a file called lab1.html which contains the HTML of a blog page. Create another filelab1.css which is linked from lab1.html , and which contains all the style formatting of thedocument. These files must match the specification given below.
Electro-magnetic force in newtons : The topic of this assignment was chosen so that you won't allow mathematical equations and scientific notation to intimidate you. No knowledge is required to complete the assignment beyond knowing how to perform mathematical operations within a fo..
The future of public health : This course has presented the various roles of the public and community health nurse.
Collective bargaining to both management and employees : Show the level of education is graduate level not 1st grade level - do not repeat the same sentences or paragraphs in other parts within the project.
Write an essay on american literature before the civil war : Write an essay on American Literature before the Civil War. Based on the readings from weeks one and two, discuss the images of America the European writers constructed to promote colonization and settlement.
Health of community : In your current practice and as a health leader in your community how will you collaborate with other healthcare providers to promote the health of your community.

Reviews

Write a Review

Programming Languages Questions & Answers

  Arguments for and against allowing mixed-mode arithmetic exp

1). State your own arguments for and against allowing mixed-mode arithmetic expressions.

  Write an assembly code segment that calls the subroutine

Write an assembly code segment that calls the subroutine New Functionif bits 5 and 6 of PORTD equal 1 and write the same code segment in part (a) using structured assembly constructs.

  Program that prompts user to enter five test scores

Write the algorithm for a program that prompts the user to enter five test scores.

  Write function which take parameter-string and returns vowel

Write function which takes as parameter and string and returns the vowels (a, e, i, o, u). Function prototype should look like: void countVowels(string str, int& aCt, int& eCt, int& iCt, int& oCt, int& uCt);

  Write a program that asks how many tickets sales

Write a program that asks how many tickets sales. Format your dollar amount in a fixed-point notation with two decimal points and make sure the decimal point is always displayed.

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Write program to compute amount of money

Write a program that computes the amount of money the computer club will receive from the proceeds of their candy sales project.

  Develop vision system for building high safe mobile robot

You are tasked to develop a vision system for building a high safe mobile robot. In particular, your system should give a warning alarm when there are a danger of colliding (at certain distance) with a pedestrian.

  Identify all the pure-strategy nash equilibria of game

Identify all of the pure-strategy Nash Equilibria of this game. Identify at least one mixed-strategy Nash Equilibrium, and show that it is a Nash Equilibrium.

  How to use bit vector to represent dynamic set of distinct

Explain how to use a bit vector to represent a Dynamic Set of Distinct Elements with no Satellite Data. Dictionary Operations must Run in O (1) Time.

  Designing the site links

Company needs to be able to schedule the time of day when the connections are available for replication. Replication should not occur during peak business hours. When designing the site links, which of the following options should you use?

  Create the object-oriented design for dvd collection

Create the object-oriented design for system which keeps tracks of your CD and DVD collection. Recognize each of the classes, associated data, and operations for classes.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd