Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Write and test a function called is_multiple_of that takes a integer n1, integer n2 and determines whether the second argument (n2) is a multiple

1. Write and test a function called is_multiple_of that takes a integer n1, integer n2 and determines whether the second argument (n2) is a multiple of the first argument (n1). The function should return 1 if n2 is a multiple of n1, and 0 if it is not. Examples: If the function is called with 2 (n1) and 6 (n2), the function should return 1 because: 6 is a multiple of 2, since 2 divides evenly into 6 If the function is called with 4 (n1) and 6 (n2), the function should return 0 because: 6 is not a multiple of 4 since 4 does not divide evenly into 6. HINT: How do you determine if one number divides evenly into another? What could we do to test to see if a number was even (divisible by 2?) 2. Write a function called get_quadrant takes 2 whole numbers representing an (x,y) point of a grid and returns the number of the quadrant that point lies in. If the point lies on an axis, the function should return -1 to indicate it does not lie in a quadrant.

3. Write and test a function called print_zodiac_sign that will take as arguments two numbers: one for the month and one for the day. The function should print the name of the zodiac sign for the specified month and day (you are not printing the image). You can assume the function will be called with values that represent a valid date (ie. you will never get the value 2, 30 as there is no February 30th.image text in transcribed

4. Write and test a function called get_seconds that takes three numbers representing a number of days, number of hours and number of minutes. The function should compute and return the number of seconds this amount of time would be in total. Examples: If the function is called with 0 days and 0 hours and 1 minute, the function should return 60 If the function is called with 0 days and 2 hours and 1 minute, the function should return 7260 If the function is called with 1 day and 1 hour and 1 minute, the function should return 90060

5. Write and test a function called print_time_conversion that takes one integer representing a number of seconds. The function should print convert the given number of seconds to the amount of time in days, hours, minutes and seconds. The function should then print the result in the this format: W days, X hours, Y minutes, Z seconds where W, X, Y and Z are the number of days, hours, minutes and seconds respectively.

6. Write and test a function called get_distance_traveled that takes 3 arguments: 2 whole numbers representing a number of days and hours traveled as integers and a floating point number representing the speed of travel in meters per second. The function should compute the distance traveled in the total time represented by the days and hours given. The function should return the distance traveled in kilometres. Recall: there are 1000 metres in 1 kilometre. Your function MUST use (call) one of the other functions you wrote in earlier in this assignment as a helper function. Example: If the function is called with 2 days, 3 hours and a speed of 7.2, the function should return 1321.92

PLEASE USE C PROGRAMMING LANGUAGE.

TEMPLATE

#include

int is_multiple_of(int n1, int n2); int get_quadrant(int x, int y); void print_zodiac_sign(int month, int day); int get_seconds(int days, int hours, int minutes); void print_time_conversion(int seconds); double get_distance_traveled(int days, int hours, double speed);

int main() {

//TEST YOUR FUNCTIONS HERE

return 0; }

// DEFINE YOUR FUNCTIONS AFTER THIS LINE

Aquarius January 20 - February 18 Pisces February 19 - March 20 Aries March 21 - April 19 Taurus April 20 - May 20 Gemini May 21 - June 20 Cancer June 21 - July 22 Virgo leo July 23 - August 22 August 23 - September 22 Libra September 23 - October 22 Scorpio October 23 - November 21 Sagittarius November 22 - December 21 Capricorn December 22 - January 19

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

Advanced Database Systems For Integration Of Media And User Environments 98

Authors: Yahiko Kambayashi, Akifumi Makinouchi, Shunsuke Uemura, Katsumi Tanaka, Yoshifumi Masunaga

1st Edition

9810234368, 978-9810234362

More Books

Students also viewed these Databases questions

Question

What are the characteristics of modern science?

Answered: 1 week ago