Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 2 (15 marks) You must develop a program that calculates the weight of a number of flat washers with the following dimensions The given

image text in transcribed

image text in transcribed

Question 2 (15 marks) You must develop a program that calculates the weight of a number of flat washers with the following dimensions The given dimension of the washer is given by its thickness (x), the external diameter (d2) and the hole diameter (d). Thus the area of the washer is given by a-xd, 2-ad,/2) The volume, v, of the washer is given by v-xa. The weight, w, of the washer is given by w vd where d is the density of washer's material. From these equations, the weight w, of n washers is given by Devclop a program that rcquests from thc uscr the following data The number n of washers .The density of the washcr's matcrial, in kg/cm The thickness x of the washer, in centimeters (cm), The external diameter, d2, of the washer in cm, The diameter of the hole, d, of the washer in cm .For the main function o Obtains the data from the user and save them in appropriate o Calls the function totalWeight to compute weight of o Display results to the user in a message (see the following variables the n flat washers example) that includes data input by the user and the weight of the washers. Format the output values to display at most the number of digits in the fractional part of the real values shown the message example The washer characteristics are Density: 0.00260 kg/cm*3 Thickness: 0.030 cm External diameter: 0.500 cm Diameter of the hole: 0.230 cm The weight of 1 washers is 1.21e 005 kg For the function totalWeight o Define parameters to receive the data input by the user o Define local variable for storing the total weight, w, o Note that the math header file, math.h, provides the symbolic constant M_PI for the value of iu o Instead of using a single instruction to compute the force value, use a number of instructions to "accumulate" values into the variable w, as follows. Note that these are not true mathematical equations but show how w, as a computer variable can accumulate intermediate values during the computation Assigns to w, the valuc ofa Assigns to w, the value of nxn(dj -di) s to w, the valuc of '"Xdx(d -d The following table gives the density of different metals and plastics that can be used in the production of flat washers: Mtal Aluminium Brass Bronze (8-14% tin) Iron Stainless steel Density in kg/cm 0.0026 0.0085 0.0074 to 0.0089 0.00787 0.00748 to 0.00795 Density in kg/cm 0.00091 to 0.00094 Plastic Polyethylene (low density) Polyethylene (high density) (Source: https://www.globalplasticsheeting.com/our-blog-resource- 0.00094 0.00096 yethylene) The following table presents test cases to be used for testing your program. Note that intermediate values for w, are provided to allow ou to trace your program to debug any problems Density d Thick.x Ext. Dia. d Dia. holej Description (n)(kgjem)(em)(cm) Weight w (kg) Aluminum 0.0026 0.03 0.s0.23 0.1971 4.83E-05 1.2IE-05 M2) Aluminum (MI60) Acier (M 1 2) 1 25 Acier (M24 52 Plastique (M20) Bronze (M3) 750 S29951.28E 2.859537 7.15E-01 64.089971.60E 0 2.159483.04E 0.557818 1.39E-01 1 0.0026 16.5 347.76 1.3 3.8325 2.5 13.11 2.19.28 0.69 0.0330.4750 0.1K)76 0.00760.39 5300.000940.29 0.0089 0,050 The answer to this question should provide i) The source code to your program (also insert the source code into the assignment file) 2) The output showing the results of all the test cases; insert the output into the assignment file

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions

Question

Develop creative ideas in a sportspecifc context.

Answered: 1 week ago

Question

Write down the Limitation of Beer - Lamberts law?

Answered: 1 week ago

Question

Discuss the Hawthorne experiments in detail

Answered: 1 week ago

Question

Explain the characteristics of a good system of control

Answered: 1 week ago

Question

State the importance of control

Answered: 1 week ago