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
  • 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++...

  • 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...

  • 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,...

  • 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...

  • 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...

  • MATLAB Define the following computer programming terms and give an example of each. MATLAB example Sequence...

    MATLAB Define the following computer programming terms and give an example of each. MATLAB example Sequence Selection structure- Repetition structure - Relational operators (True = 1, False = 0) Logical operators (True = 1, False =0) And Or Less than Less than or equal to Greater than Greater than or equal to Equal to Not equal to Not ans ans Type the following relational operator commands into MATLAB in the command window one at a time. Write the results to...

  • please help me solve these. discrete structures for computing. Answer the following 1) 2points Use a...

    please help me solve these. discrete structures for computing. Answer the following 1) 2points Use a table to express the values of the Boolean function: F(x, y, z) = xy + (xyz) 0 0 0 0 0 1 0 1 0 011 1 0 0 1 0 1 110 11 2) 2points) Find the sum-of-products expansion of the Boolean function: F(x, y, z) = (x + 2)y. i.e. 3) (2 points] Express the Boolean function F(x, y, z) = xy...

  • I should use the array and loop to create a java program according to the instruction,...

    I should use the array and loop to create a java program according to the instruction, but I have no idea how to do it. Introduction This lab assignment continues to give you practice using loops, particularly loops with variable termination conditions, and it also provides you an opportunity to use one-dimensional arrays. Recall that an array is used to store a collection of data. The data can be values of Java primitive data types or else objects (for instance,...

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