Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please provide all answers according to question numbers thank you. 1.12 (Average speed in kilometers) Assume a runner runs 24 miles in 1 hour, 40

please provide all answers according to question numbers thank you.
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
1.12 (Average speed in kilometers) Assume a runner runs 24 miles in 1 hour, 40 minutes, and 35 seconds. Write a program that displays the average speed in kilometers per hour. (Note that 1 mile is 1.6 kilometers.) **2.6 (Sum the digits in an integer) Write a program that reads an integer between 0 and 1000 and adds all the digits in the integer. For example, if an integer is 932, the sum of all its digits is 14. Hint: Use the operator to extract digits, and use the / operator to remove the extracted digit. For instance, 932 10 = 2 and 932 / 10 = 93. Here is a sample run: Sample Run for Exercise02_06.cpp Enter input data for the program (Sample data provided below. You may modify it.) 435 Show the Sample Output Using the Preceeding Input Reset Execution Result: command>Exercise02 06 Enter a number between and 100e: 435 The sum of the digits is 12 command> 2.15 (Geometry: distance of two points) Write a program that prompts the user to enter two points (x1, yl) and (x2, y2) and displays their distance between them. The formula for computing the distance is (22 - 21) + (92-y). Note that you can use pow(a, 0.5) to computeva. Here is a sample run: Sample Run for Exercise02_15.cpp Enter input data for the program (Sample data provided below. You may modify it.) 1.5 -3.4 4.0 5.0 Reset Show the Sample Output Using the Preceeding Input Execution Result: command>Exercisee2_15 Enter xl and yi: 1.5 -3.4 Enter x2 and y2: 4 5 The distance of the two points is 8.76413 command> **3.16 (Compute the perimeter of a triangle) Write a program that reads three edges for a triangle and computes the perimeter if the input is valid. Otherwise, display that the input is invalid.The input is valid if the sum of every pair of two edges is greater than the remaining edge. Sample Run for Exercise03_16.cpp Enter input data for the program (Sample data provided below. You may modify it.) 1.2 2.1 1.7 Show the Sample Output Using the Preceeding Input Execution Result: Reset command>Exercise 16 Enter three edges: 1.2 2.1 1.7 The perimeter is 5 command> *3.5 (Find future dates) Write a program that prompts the user to enter an integer for today's day of the week (Sunday is 0, Monday is 1, ..., and Saturday is 6). Also, prompt the user to enter the number of days after today for a future day and display the future day of the week. Here is a sample run: Sample Run for Exercise03_05.cpp Enter input data for the program (Sample data provided below. You may modify it.) Show the Sample Output Using the Preceeding Input Reset Execution Result command>Exercisee3_05 Enter today's day: 1 Enter the number of days elapsed since today: 3 Today is Monday and the future day is Thursday command> *4.10 (Vowel or consonant?) Assume letters A/a, E/e, I/i, 0/0, and u/u as the vowels. Write a program that prompts the user to enter a letter and check whether the letter is a vowel or consonant. For an incorrect input, display invalid input. Here is a sample run: Sample Run for Exercise04_10.cpp Enter input data for the program (Sample data provided below. You may modify it.) Reset Show the Sample Output Using the Preceeding Input Execution Result: command>Exercise84 10 Enter a letter: B B is a consonant command> *4.21 (Student major and status) Write a program that prompts the user to enter two characters and displays the major and status represented in the characters. The first character indicates the major and the second is number character 1, 2, 3, 4, which indicates whether a student is a freshman, sophomore, junior, or senior. Suppose the following characters are used to denote the majors: M: C: I: Mathematics Computer Science Information Technology Here is a sample run: Sample Run for Exercise04 21.cpp Enter input data for the program (Sample data provided below. You may modify it.) Reset Show the Sample Output Using the Preceeding Input Execution Result: command>Exercise04_21 Enter two characters: M1 Mathematics Freshman command>

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

Professional SQL Server 2000 Database Design

Authors: Louis Davidson

1st Edition

1861004761, 978-1861004765

More Books

Students also viewed these Databases questions