Question

Complete the implementation of the point_3d program. This program will help you learn how to use:...

Complete the implementation of the point_3d program. This program will help you learn how to use: the C language if statement; relational operators; and boolean operators. The program must implement a function which maps real-valued point (x,y) to real value z≥0, as follows: z=2.84898x+1.18569y, when x≥0 and y≥0; z=2.84898x+y2, when x≥0 and y<0; z=x2+1.18569y, when x<0 and y≥0; z=x2+y2, otherwise. To get the values of x and y, display a prompt of the form "Please enter X and Y:" The prompt should appear on a line by itself. To display the results, use a message of the form "(X, Y) -> Z." where X and Y are the numeric values entered by the user, and z is the result computed according to equations 1–4. All results should be displayed with 8 decimal places.(In C proragming)

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

Here is the code below :

#include<stdio.h>

int main(){

    float x, y, z;

    printf("Please enter X and Y: ");

    scanf("%f %f", &x, &y);

    if((x >= 0) && (y >= 0)){

        z = (2.84898 * x) + (1.18569 * y);

        printf("(%f, %f) -> %.8f.", x, y, z);

    }else if((x >= 0) && (y < 0)){

        

        z = (2.84898 * x) + (2 * y);

        printf("(%f, %f) -> %.8f.", x, y, z);

    }else if((x < 0) && (y >=0 )){

        

        z = (x * 2) + (1.18569 * y);

        printf("(%f, %f) -> %.8f.", x, y, z);

    }else{

        z = (2 * x) + (2 * y);

        printf("(%f, %f) -> %.8f.", x, y, z);

    }

    return 0;

}

Hope you find the solution good.

Have a Good Day !!

Please Upvote the answer if you like.

Add a comment
Know the answer?
Add Answer to:
Complete the implementation of the point_3d program. This program will help you learn how to use:...
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
  • Write a JAVASCRIPT program that will help an elementary school student learn multiplication. Use the Random...

    Write a JAVASCRIPT program that will help an elementary school student learn multiplication. Use the Random method to produce two positive one-digit integers. The program should then prompt the user with a question using random numbers, such as How much is 6 times 7? The student then inputs the answer. Next, the program checks the student’s answer. If it is correct, display the message "Very good!" and ask whether the student wants to continue if so then ask another multiplication...

  • Java Programming Write a program that will help a student learn multiplication. Use SecureRandom object to...

    Java Programming Write a program that will help a student learn multiplication. Use SecureRandom object to produce two positive integers between 1 and 20. The program should then prompt the user with a question (use a sentinel-controlled loop), such as: How much is 10 times 11? The student then inputs the answer. If the answer is correct display the message “very good” and ask another question. If the answer is wrong to display the message “no, please try again” and...

  • The manager of the Telemarketing Group has asked you to write a program that will help...

    The manager of the Telemarketing Group has asked you to write a program that will help order- entry operators look up product prices. The program should prompt the user to enter a product number, and will then display the title, description, and price of the product. The program will consist of the following functions. getProdNum: it asks the user to enter a product number. Please be sure to reject any value out of the range of correct product numbers. binarySearch:...

  • The manager of the Telemarketing Group has asked you to write a program that will help...

    The manager of the Telemarketing Group has asked you to write a program that will help order- entry operators look up product prices. The program should prompt the user to enter a product number, and will then display the title, description, and price of the product. The program will consist of the following functions. getProdNum: it asks the user to enter a product number. Please be sure to reject any value out of the range of correct product numbers. C++...

  • Problem: Write a program that behaves as described below.If the first command-line argument after the program...

    Problem: Write a program that behaves as described below.If the first command-line argument after the program name (argv[1]) is “--help”, print the usage information for the program. If that argument is not “--help”, you are to expectargv[1]and subsequent arguments to be real numbers(C, integer, float, or double types)in formats acceptable to the sscanf()function of the C library or strings of ASCII chars that are not readable as real numbers. You are to read the numbers, count them and calculate the...

  • Write a program that will help a student learn multiplication. Use SecureRandom object to produce two...

    Write a program that will help a student learn multiplication. Use SecureRandom object to produce two positive integers between 1 and 20. The program should then prompt the user with a question (use a sentinel-controlled loop), such as: How much is 10 times 11? The student then inputs the answer. If the answer is correct display the message “very good” and ask another question. If the answer is wrong to display the message “no, please try again” and let the...

  • Lab Assignment Objectives: Translate a basic application statement into a software selection solution. Learn how to...

    Lab Assignment Objectives: Translate a basic application statement into a software selection solution. Learn how to design and implement a simple program control structure. Use logical operators and boolean variables to set up test conditions. Construct applicable test cases to test your programs for correctness. Understand the Application You will obtain a grocery bill total from the customer. Depending on the amount of the grocery bill a coupon rewards amount will be calculated. The user will be informed of the...

  • Create a complete Assembly Language program implementation for the following application with a) 32-bit and b)...

    Create a complete Assembly Language program implementation for the following application with a) 32-bit and b) 64-bit version (If Possible) App1: Geometric Shape Calculator Companion. The program details (design, implementation, code, runs) should show evidence of technical proficiency with the following technological aspects: 1. a) Implementation using 32-bit programming. b) Re-implement using 64-bit programming. 2. Test plan; test cases implementing the test plan and screen shots displaying the executing the test cases. Note: a test plan should include various Normal,...

  • In this program, you will be using C++ programming constructs, such as overloaded functions. Write a...

    In this program, you will be using C++ programming constructs, such as overloaded functions. Write a program that requests 3 integers from the user and displays the largest one entered. Your program will then request 3 characters from the user and display the largest character entered. If the user enters a non-alphabetic character, your program will display an error message. You must fill in the body of main() to prompt the user for input, and call the overloaded function showBiggest()...

  • write a program for python 3 write the functions that could be used in an implementation...

    write a program for python 3 write the functions that could be used in an implementation of the game tic-tac-toe. Below are the definitions of the different functions. The code to test each function is currently in the main() of the lab10.py file. • A function to build the board. This method should create a list of the numbers 1 – 9 and return that list. build_board () -> list • A void function to display the board. (see the...

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