Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question: 1 Write a program in C++ that has function printTempOpinion (int temp) which prints Cold on if the temperature is below 10, OK if

Question: 1 Write a program in C++ that has function printTempOpinion (int temp) which prints "Cold" on if the temperature is below 10, "OK" if the temperature is in the range 20 - 30, "Hot" if the temperature is above 30.

Question: 2 Write a C++ program which has a printdate (int, int, int) function. Get month, day & year from user in main ( ). Call the function printDate(int, int, int), Put a check in printDate() using if statement (month < 1 || month > 12 || day < 1 || day > 31 || year < 0) & if it violates the rule display Must Enter a Valid Date, otherwise display the date in this format (dd,mm,yyyy)

Question: 3 Write a program that asks the user to enter the width and length of a rectangle and then display the rectangles area. The program calls the following functions, getLength This function should ask the user to enter the rectangles length and then return that value as a double . getWidth This function should ask the user to enter the rectangles width and then return that value as a double . getArea This function should accept the rectangles length and width as arguments and return the rectangles area. The area is calculated by multiplying the length by the width. displayData This function should accept the rectangles length, width, and area as arguments and display them in an appropriate message on the screen.

Question: 4 Your friend Michael runs a catering company. Some of the ingredients that his recipes require are measured in cups. When he goes to the grocery store to buy those ingredients, however, they are sold only by the fluid ounce. He has asked you to write a simple program that converts cups to fluid ounces. You design the following algorithm: 1. Display an introductory screen that explains what the program does. 2. Get the number of cups. 3. Convert the number of cups to fluid ounces and display the result.

Question: 5 When an object is falling because of gravity, the following formula can be used to determine the distance the object falls in a specific time period: d=1/2gt2 The variables in the formula are as follows: d is the distance in meters, g is 9.8, and t is the amount of time, in seconds, that the object has been falling. Write a function named fallingDistance that accepts an objects falling time (in seconds) as an argument. The function should return the distance, in meters, that the object has fallen during that time interval. Write a program that demonstrates the function by calling it in a loop that passes the values 1 through 10 as arguments and displays the return value.

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions

Question

Find focus and directrix of parabola y? = 4ax. %3D

Answered: 1 week ago

Question

=+3 In what ways can an MNE improve or change its approach to IHRM?

Answered: 1 week ago