Write a C program that evaluates the equations provided below. The program must prompt the user...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a C program that evaluates the equations provided below. The program must prompt the user for inputs to the equations and evaluate them based on the inputs. All variables on the right hand sides of the equations must be inputted by the user. All variables, except for the plaintext_character, encoded_character, variable a, shift, R1, R2, and R3 are floating-point values. The plaintext_character and encoded_character variables are characters, and the a, shift, R1, R2, and R3 variables are integers. The constant Pl must be defined as a constant macro (#defined constants). Error checking is not required for your program. You do not need to check for faulty user input or dividing by zero. However, please consider inputs that could cause your program to work incorrectly. 1. Newton's Second Law of Motion: force = mass * acceleration 2. Volume of a cylinder: volume_cylinder = PI * radius² height 3. Character encoding: encoded_character = (plaintext_character 'A') + 'a' shift; shift is an integer (note: what happens if plaintext_character is uppercase? What happens with various shift keys?) 4. Distance between two points: distance = square root of ((x₁ - x₂)² + (y₁ - y₂)²) (note: you will need to use sqrt () out of <math.h>) 5. Tangent: tan_thetasin (theta) / cos (theta) (recall: find the appropriate functions in <math.h>) 6. Total resistance of resistors in paralell: total_resistance = 1 / (1/R1+1/R2 + 1/R3), for 3 resistors. R1, R2, and R3 are integers. 7. General equation: y = (2/3) -y +z x/ (a % 2) + PI (recall: a is an integer; the 2 and 3 constants in the equation should be left as integers initially, but explicitly type-casted as floating- point values) Write a C program that evaluates the equations provided below. The program must prompt the user for inputs to the equations and evaluate them based on the inputs. All variables on the right hand sides of the equations must be inputted by the user. All variables, except for the plaintext_character, encoded_character, variable a, shift, R1, R2, and R3 are floating-point values. The plaintext_character and encoded_character variables are characters, and the a, shift, R1, R2, and R3 variables are integers. The constant Pl must be defined as a constant macro (#defined constants). Error checking is not required for your program. You do not need to check for faulty user input or dividing by zero. However, please consider inputs that could cause your program to work incorrectly. 1. Newton's Second Law of Motion: force = mass * acceleration 2. Volume of a cylinder: volume_cylinder = PI * radius² height 3. Character encoding: encoded_character = (plaintext_character 'A') + 'a' shift; shift is an integer (note: what happens if plaintext_character is uppercase? What happens with various shift keys?) 4. Distance between two points: distance = square root of ((x₁ - x₂)² + (y₁ - y₂)²) (note: you will need to use sqrt () out of <math.h>) 5. Tangent: tan_thetasin (theta) / cos (theta) (recall: find the appropriate functions in <math.h>) 6. Total resistance of resistors in paralell: total_resistance = 1 / (1/R1+1/R2 + 1/R3), for 3 resistors. R1, R2, and R3 are integers. 7. General equation: y = (2/3) -y +z x/ (a % 2) + PI (recall: a is an integer; the 2 and 3 constants in the equation should be left as integers initially, but explicitly type-casted as floating- point values)
Expert Answer:
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these computer network questions
-
In this question assume that p and q are atomic formulae. (a) Compare and contrast path formulae and state formulae in temporal logic. [4 marks] (b) Describe and contrast the meanings of F(G p) and...
-
According to the Statute of Frauds, in order to be legally enforceable, a contract must be in writing, name the contracting parties, identify the subject matter of the contract, and Be for a legal...
-
In the following testcross, genes a and b are 20 cM apart, and genes b and c are 10 cM apart: a + c /+ b + a b c / b c. If the coefficient of coincidence is 0.5 over this interval on the linkage...
-
The m.e.p. of a diesel engine with fixed compression ration can be improved by: (a) Increasing cut-off ratio (b) Increasing back pressure (c) Increasing operating pressure (d) Reducing charge density
-
Calculate the amount of magnetic potential energy stored in a \(0.60-\mathrm{H}\) inductor when the current in the inductor is \(6.0 \mathrm{~A}\).
-
Suppose that Westside Auto of Problem 4, with D = 12,000 units per year, Ch = (2.50)(0.20) = $0.50, and Co = $25, decided to operate with a backorder inventory policy. Backorder costs are estimated...
-
11. 12. The product formed in the first step of the reaction of Br CH3-CH2-CH-CH2-CH-CH3 with excess Mg/ Et2O (Et = C2H5) is: Br (A) CH3-CH2-CH-CH2-CH-CH3 H3C-CH-CH2-CH-CH2-CH3 CH2 (B) CH3-CH CH-CH3...
-
What is activity-based costing, and what are its potential benefits?
-
A room is 10m by !Om by 3m. Determine the mass and weight of air in the room if the air's average density is 1.18 kg/m
-
A Project Manager discovers that his team has neglected to complete the network diagram for the project. The network diagram is shown below but you need to fill the duration, ES/EF/LS/LF & Slack for...
-
An electroscope is a device made of a metal ball connected through a wire to two aluminum plates that are suspended inside a glass flask. A student generates electrostatic energy by rubbing a plastic...
-
The current US Dollar to Yen exchange rate is Mo 110. The CCIR US rate is 4% and the CCIR Japanese rate is 2%. Banco Santander is currently willing to offer a one-month forward contract (assuming...
-
Describe in words why minimizing the sum of the absolute deviations for a linear model is different from minimizing the sum of the squared deviations for a linear model. How might you teach this to...
-
Conflict Styles Assessment Dr. Stella Ting-Toomey & Dr. Leeva Chung, UIC Text, pp.193-194/ my.blog 9.3 Assessing Your Specific Five Conflict Styles: Instructions: Recall how you generally communicate...
-
Would you recommend an investment in this company? (YES or NO) That recommendation will be on the Top of the COVER PAGE of your final report. The report that follows your cover page will be the...
-
According to a New York Times columnist, The estate tax affects a surprisingly small number of people. In 2003, . . . just 1.25 percent of all deaths resulted in taxable estates, with most of them...
-
Emily Jackson (Social Security number 765-12-4326) and James Stewart (Social Security number 466-74-9932) are partners in a partnership that owns and operates a barber shop. The partnership's first...
-
Sherry rents her vacation home for 6 months and lives in it for 6 months during the year. Her gross rental income during the year is $4,000. Total real estate taxes for the home are $950, and...
-
Van makes an investment in a partnership in 2012. Van's capital contributions to the partnership consisted of $30,000 cash and a building with an adjusted basis of$70,000, subject to a nonrecourse...
-
A positively charged particle moves from point I to point 2. As it does, its electric potential energy? A. Increases. B. Decreases. C. Stays the same. 102
-
Rank in order, from largest to smallest, the potential differences V 12 , V 13 , and V 23 between points 1 and 2, points l and 3, and points 2 and 3.
-
Which set of equipotential surfaces matches this electric field? 111
Study smarter with the SolutionInn App