Question

Please can someone help me to finish this program? It is a C programming not a C++, when programming the program in linux I keep getting expected expression before || token, also please check if everything else is fine, maybe there is something else worng in my program and may ask me later to fix it, I am concern about the sin and cosine. The program is supposed to do all this:

1.Display a welcome message.

2.Prompt for the height above ground (we’re assuming a flat firing area) and accept anything above 0 (you can set a reasonable upper limit, such as 1 mile, if you wish). If the input is out of the acceptable range, print an error message and repeat the input until an acceptable value is input.

3.Similarly, prompt for the firing angle and accept between 90 and -90.

And, finally, prompt for the initial velocity (we’ll assume there is no acceleration due to firing or wind resistance). Pay attention to units; if your calculations are in meters and seconds, don’t prompt for feet and minutes unless you want to do the conversions.

4.Calculate the time and distance to impact. You’ll need to get the vertical and horizontal velocity vectors from the firing angle and the initial velocity. If the angle is positive, the time to return to the same height is 2 * initial vertical velocity / g. The time to continue to the ground is (height * 16) / (velocity * 15). This is a rough approximation but is good enough for this project. Add the two times together to get the time to impact and then multiply that by the horizontal velocity to get the distance to impact.

5.For your output, restate the user’s inputs and then display the time and distance to impact.

6.Prompt the user to see if they want to do another calculation and, depending on their input, return to the beginning or exit the program

And this is the program please any suggestions in the error that I am getting?? I rreally want this to compile and execute

C He Ale Options utters Tool A a include td ude nath tuoat eight angle, velocity, v velocity h velocity 9, 8 float tine e-0, tine cont tine inpact e inpact print (Vn\t\t\t ****ilELCOIEWn)://welcone message intf eight above ground //prompt user to height ght f eight-1 eight 1639 eight i betwee ange print the error ness age mile and greater than whilelheight<1): eight 609 //loop ntil the correct high is entered 1ntt NTER tiring prompt user to get angle canf &angle //taking value of angle fron if (angles -90) II (angl, 90 angle is not between range print the error message RROR: angle should be 90 90 angle 90 II angle 90 printf tial velocity elocity- angle) velocity velocity Icos langle velocity angle-0 time retum 2 v velocity)/g:I time impact time return +time ont inue distance inpact time impact *h v elocity //output int Firing angle: tWtsf angle intt itial velocity: t velocity At MtVert velocity f v velocity h velocity) int VtTine to ine intt At tl ine to continue: t e conti lt time to inpact: tlt f ,tine inpact a impact: Vt t f distance inpact): roject C L29 Abbrev We ome to he ng system. ponent 0 M Dunacs Tutorial key strol GNU Emacs Top 13 undamental emacs (adantooine rm2297@dantooine: Using username m 2297 ast login Wed Feb 8 22: 33:07 2017 from egri00a-12.egr.nau.edu rm2297 dantooine emaca project.c rm2297 dantooine: gcc -o project project.c project. In function main project. C:16 expected before token project. C:23 expected before token rm2297 dantooine: emaca project.c rm2297 dantooine: gcc -o project project.c project. In function main project. C:16 expected expression before token project. C:23 expected expression before token cm2297 dantooine emacs project.c 942 AM

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The error is due to a syntax mistake in the while conditions. You can replace it with the following code to get rid of the errors:

do{
       printf("Enter height\n");
       scanf("%f",&height);
       if((height<1) || height>1609)
printf("Error: height should be less than 1 mile and greater than 0\n");
}while(height<1 || height >1609);
do{
       printf("Enter angle\n");
       scanf("%f",&angle);
       if((angle<=-90) || angle>=90)
printf("Error: angle should be between -90 and 90\n");
}while((angle<=-90) || angle>=90);

As you can see, we should not include a ";" before "||" in the while statement. Removing that will result in proper running of the code.

Add a comment
Know the answer?
Add Answer to:
Please can someone help me to finish this program? It is a C programming not a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • please tell me the answer and tell me why you chose it please help me!! i...

    please tell me the answer and tell me why you chose it please help me!! i would appreciate it This page LUNClusions on the back of C) 9.8 m/s o D) 10 miles per hour 18) Calculate the velocity acciate the velocity at time t=2s for a ball the A) 10.1 m/s B) -5.2 m/s C) 0.3 m/s D) 4.6 m/s straight up with an initial velocity of 15 m 19) A rock is tossed skyward at an angle of...

  • Python Please. a)Let a program store the result of applying the eval function to the first...

    Python Please. a)Let a program store the result of applying the eval function to the first command-line argument. Print out the resulting object and its type. Run the program with different input: an integer, a real number, a list, and a tuple. (On Unix systems you need to surround the tuple expressions in quotes on the command line to avoid error message from the Unix shell.) Try the string "this is a string" as a commandline argument. Why does this...

  • Can you please help me with the Practice it on the Exercise? The Exercise it where...

    Can you please help me with the Practice it on the Exercise? The Exercise it where I really need help . Thanks!(: QUESTION How would the answer to part (b), the maximum height, change if the person throwing the ball jumped upward at the instant he released the ball? The maximum height would decrease. The maximum height would remain the same. The maximum height would increase. Consider how the initial velocity of the ball relative to the ground is affected...

  • can someone write me a wing101 python code for this please Question: For a projectile launched with a velocity vIm/s) at an angle to the horizontal 6 Iradl, the horizontal distance travelled (al...

    can someone write me a wing101 python code for this please Question: For a projectile launched with a velocity vIm/s) at an angle to the horizontal 6 Iradl, the horizontal distance travelled (also called the range) is given by where the altitude of the landing position is Δh higher than that of the launch position and g is the gravitational acceleration (use 9.81 m/s^2). Note: θ in theformula is in radians write a Python function that accepts ν, θ and...

  • Can someone help me with these 2. All my answers are apparently wrong on number 11....

    Can someone help me with these 2. All my answers are apparently wrong on number 11. 9 11 A student stands at the edge of a cliff and throws a stone horizontally over the edge with a speed of v = 13.5 m/s. The cliff is h 36.0 m above a flat, horizontal beach as shown in the fiqure (a) What are the coordinates of the initial position of the stone? Yo36 (b) What are the components of the initial...

  • C++ please Programming Assignment #6 Help Me Find The Secret Message Description: This assignment will require...

    C++ please Programming Assignment #6 Help Me Find The Secret Message Description: This assignment will require that you read in an encrypted message from a file, decode the message, and then output the message to a file. The encryption method being used on the file is called a shift cipher (Info Here). I will provide you with a sample encrypted message, the offset, and the decrypted message for testing. For this project I will provide you main.cpp, ShiftCipher.h, and ShiftCipher.cpp....

  • C++ please A typical problem encountered in the study of dynamics is the trajectory problem. In...

    C++ please A typical problem encountered in the study of dynamics is the trajectory problem. In the situation illustrated below, a projectile is fired from the edge of a cliff with an initial velocity, Vo , and a firing angle, A. The cliff has a height, h. It is desired to:           1.       determine the distance, xt, to the target           2.       determine the highest elevation reached, ymax           3.       determine the time to reach the target, tt           4.      ...

  • Can someone please help me with these ore lab questions. I added A,B, and C to...

    Can someone please help me with these ore lab questions. I added A,B, and C to hope help thanks Pre-Lab Assignment Due at the beginning of Lab) that cover kinetic and potential energy Read over the lab and your textbook momentum and collisions then answer the following questions What effect does the force of gravity have on the horizontal velocity of the projectile? Explain. 1. What effect does air resistance and friction have on the velocity and range of a...

  • 5.15 PROGRAM: Functions - Upset Fowls (C++) (1) Correct the first FIXME by moving the intro...

    5.15 PROGRAM: Functions - Upset Fowls (C++) (1) Correct the first FIXME by moving the intro text to the function stub named PrintIntro and then calling the PrintIntro function in main. Development suggestion: Verify the program has the same behavior before continuing. (2) Correct the second FIXME by completing the function stub GetUsrInpt and then calling this function in main. Notice that the function GetUsrInpt will need to return two values: fowlAngle and fowlVel. (3) Correct the third FIXME by...

  • Java programming help My program wont run. could someone tell me why. everything seems correct to...

    Java programming help My program wont run. could someone tell me why. everything seems correct to me... giving me the error: Exception in thread "main" java.lang.NumberFormatException: For input string: "Stud" at java.base/java.lang.NumberFormatException.forInputString(Unknown Source) at java.base/java.lang.Integer.parseInt(Unknown Source) at java.base/java.lang.Integer.parseInt(Unknown Source) at Util.readFile(Util.java:35) at Driver.main(Driver.java:8) _________________________________________________________________________________________________________________________ Program Prompt: Write a program to perform statistical analysis of scores for a class of students.The class may have up to 40 students.There are five quizzes during the term. Each student is identified by a four-digit...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT