Get Instant Help From 5000+ Experts For
question

Writing: Get your essay and assignment written from scratch by PhD expert

Rewriting: Paraphrase or rewrite your friend's essay with similar meaning at reduced cost

Editing:Proofread your work by experts and improve grade at Lowest cost

And Improve Your Grades
myassignmenthelp.com
loader
Phone no. Missing!

Enter phone no. to receive critical updates and urgent messages !

Attach file

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Guaranteed Higher Grade!
Free Quote
wave
Building and Using Recursive Functions in Programming - Example Problem

Questions:

Objective:

 

Students will display their knowledge of building and using recursive functions (and previous course topics) in programming using a real-world example.

Problem:
You have been hired by a construction firm as an engineering consultant for a rock blasting project. It is your job to make sure that the vibrational energy caused by the blasts will not result in structural damage in any buildings in the surrounding area. As part of the problem analysis, you have investigated the geological conditions of the area. Between the blast site and the nearest building, there are 12 different bands of rock of equal width – meaning the vibrational waves from the blast will travel the same distance across each band. The velocity of the waves will be affected based on the following modifiers (ordered from closest to furthest from the blast site). Note that the nearest building is situated just beyond these 12 bands of rock.

 

[Blast site]    -3%    -18%    +34%    +0%    -23%    -31%    +18%    +3%    -8%    -21%    -10%    +25%    [Nearest Building]

Your task is to create a computer program that can, based on the nearest building’s (arbitrary) maximum tolerable relative intensity and wave velocity, calculate the wave velocity and relative intensity of the largest possible blast. The relative intensity can be modeled with the following formula: I_0 = I_1 + d/v where I_0 is the vibration intensity in the current rock band, d is the number of rock bands between the blast site and the current band, v is the vibrational wave velocity in the current rock band, and I_1 is the vibration intensity at the next closest rock band in the direction of the building.

 

Instructions:
Write a program in C to performing the following tasks:

In your main function, do the following:
Prompt the user to enter the maximum tolerable relative intensity and wave velocity.
Call the getVelocity function (see below) to get the maximum wave velocity at the blast site, and outputs it using the format shown in the sample solution below. 
Call the getIntensity function (see below) to get the maximum relative intensity at the blast site, and outputs it using the format shown in the sample output below. 

 

Write a recursive function called getVelocity that performs the following:
        Checks if your index is beyond the final rock band (closest to the building). If true, it returns the maximum tolerable wave velocity.
        Returns the wave velocity before it passes through the current rock band (by dividing the wave velocity after passing through the current rock band by the current band’s modifier).
    Write a recursive function called getIntensity that performs the following:
        Checks if your index is beyond the final rock band (closest to the building). If true, it returns the maximum tolerable relative intensity.
        Calls the getVelocity function to compute the wave velocity at the current rock band.
        Returns the relative intensity, I¬0, based on the equation described above (note that you will have to call getIntensity to get the relative intensity through the next closest rock band in the direction of the building).

 

Your program will need to take user input for the building’s maximum tolerable values. Read this input with the scanf function, using the format shown in bold in the sample output.

 

Comments are mandatory for this assignment. Add comments as necessary for important parts of your code, such as function calls & definitions, conditional statements, and calculations to explain what the program is doing.
Your output must match the sample output below as closely as possible; otherwise, the autograding software will not be able to grade your assignment, which may affect your mark. 

 

Sample Output: 
(Note: Make sure each float value is printed to 3 decimal places, and that the last line also prints a new line.)
The below output displays results for a maximum relative intensity of 3.7 and a maximum wave velocity of 22.4 m/s:

Enter max relative intensity & wave velocity: 3.7 22.4
Vibrations have max initial velocity of 39.804 m/s
Blast site has max relative intensity of 6.402

 

Submission Instructions:
You can either utilize the Mimir IDE found here to create and submit your program, or create your program using CLion and upload it here for grading. Your program file must be named “apsc143assign9.c” in order for your assignment to be graded. Do not include any personal information (student number, name, etc.) in your submission.
To compile and run the program in the Mimir IDE, enter the following command into the terminal:

gcc apsc143assign9.c -lm -o assign9 && ./assign9

 

Refer to the assignment rubric on OnQ for a detailed breakdown of the grading criteria. Your submission must adhere to the assignment rules as outlined in the submission policy document for this course, which can also be found on OnQ. There is zero tolerance for plagiarism in this course. This autograding software will automatically flag potential cases of plagiarism, which will be reviewed by the instructors. 

 

More information on both assignment submissions and the specific definition and repercussions of plagiarism can be found in the “Begin Here (About This Course)” module on OnQ in the “Assignments” and “Plagiarism” videos, respectively.

support
close