Question

In: Computer Science

Using C# Design and implement a program (name it CheckPoint) that prompts the user to enter...

Using C# Design and implement a program (name it CheckPoint) that prompts the user to enter the x-coordinate then y-coordinate of a point (in a Cartesian plane) as integer values. The program prints out the entered values followed by the location of the point on the plane. The possibilities for a point are: the origin point, on the x-axis, on the y-axis, in the first quadrant, in the second quadrant, in the third quadrant, or in the fourth quadrant. Format the outputs following the sample runs below.

Sample run 1:

X-coordinate is 0

Y-coordinate is 0

(0, 0) is the origin point.

Solutions

Expert Solution

using System;

class CheckPoint
{
    // Function to check quadrant
    static void quadrant(int x, int y)
    {
        if (x > 0 && y > 0)
            Console.WriteLine("("+x+","+y+")"+" lies in First quadrant");
  
        else if (x < 0 && y > 0)
            Console.WriteLine("("+x+","+y+")"+" lies in Second quadrant");
  
        else if (x < 0 && y < 0)
            Console.WriteLine("("+x+","+y+")"+" lies in Third quadrant");
  
        else if (x > 0 && y < 0)
            Console.WriteLine("("+x+","+y+")"+" lies in Fourth quadrant");
  
        else if (x == 0 && y > 0)
            Console.WriteLine("("+x+","+y+")"+" is on the positive y axis");
  
        else if (x == 0 && y < 0)
            Console.WriteLine("("+x+","+y+")"+" is on the negative y axis");
  
        else if (y == 0 && x < 0)
            Console.WriteLine("("+x+","+y+")"+" is on the negative x axis");
  
        else if (y == 0 && x > 0)
            Console.WriteLine("("+x+","+y+")"+" is on the positive x axis");
  
        else
            Console.WriteLine("("+x+","+y+")"+" is the origin point");
    }
    static void Main(string[] args)
    {
        Console.Write("Enter X-Coordinate: ");
        string X = Console.ReadLine();
        Console.Write("Enter Y-Coordinate: ");
        string Y = Console.ReadLine();
        int x = Convert.ToInt32(X);
        int y = Convert.ToInt32(Y);
        Console.WriteLine("X-coordinate is "+x);
        Console.WriteLine("Y-coordinate is "+y);
        quadrant(x,y);
        Console.Read();
    }
}

/* PLEASE UPVOTE */


Related Solutions

Using C# Design and implement a program (name it ProcessGrades) that reads from the user four...
Using C# Design and implement a program (name it ProcessGrades) that reads from the user four integer values between 0 and 100, representing grades. The program then, on separate lines, prints out the entered grades followed by the highest grade, lowest grade, and averages of all four grades. Format the outputs following the sample runs below. Sample run 1: You entered:   95, 80, 100, 70 Highest grade:100 Lowest grade:  70 Average grade:86.25
Design and implement a C++ program that performs the following steps:Ask the user to enter a...
Design and implement a C++ program that performs the following steps:Ask the user to enter a positive integer number N; Your program may need to prompt the user to enter many times until it reads in a positive number;Let user to enter N (obtained in the previous step) floating point numbers, and count how many positive ones there are in the sequence and sum up these positive numbers; (Hint: negative numbers or 0 are ignored).Display result.You can and should use...
Write a program in c++ using only if statements that prompts the user to enter an...
Write a program in c++ using only if statements 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) then displays today. Also, prompt the user to enter the number of days after today for a future day and display the future day of the week. The future day can be computed as follows: (today + number of days after today) % 7 Sample run...
( USE C++ ) The program prompts the user to enter a word. The program then...
( USE C++ ) The program prompts the user to enter a word. The program then prints out the word with letters in backward order. For example, if the user enter "hello" then the program would print "olleh" show that it works .
In C++ Design and implement a program (name it ProcessGrades) that reads from the user four...
In C++ Design and implement a program (name it ProcessGrades) that reads from the user four integer values between 0 and 100, representing grades. The program then, on separate lines, prints out the entered grades followed by the highest grade, lowest grade, and averages of all four grades. Format the outputs following the sample runs below.
Write a JAVA program that prompts the user to enter a single name. Use a for...
Write a JAVA program that prompts the user to enter a single name. Use a for loop to determine if the name entered by the user contains at least 1 uppercase and 3 lowercase letters. If the name meets this policy, output that the name has been accepted. Otherwise, output that the name is invalid.
Write a program that prompts the user to enter a file name, then opens the file...
Write a program that prompts the user to enter a file name, then opens the file in text mode and reads names. The file contains one name on each line. The program then compares each name with the name that is at the end of the file in a symmetrical position. For example if the file contains 10 names, the name #1 is compared with name #10, name #2 is compared with name #9, and so on. If you find...
IN C++ Write a program that prompts the user to enter the number of students and...
IN C++ Write a program that prompts the user to enter the number of students and each student’s name and score, and finally displays the student with the highest score (display the student’s name and score). Also calculate the average score and indicate by how much the highest score differs from the average. Use a while loop. Sample Output Please enter the number of students: 4 Enter the student name: Ben Simmons Enter the score: 70 Enter the student name:...
First, the Python program prompts user to enter user information (name, email, and phone number). Then...
First, the Python program prompts user to enter user information (name, email, and phone number). Then it displays a menu called “Fish Information” that has the following fish type: 1. Cat Fish 2. Red Fish 3. Any other fish Let user choose the fish type that he/she got and input the length of the fish. Then the program will determine what should be done with this particular fish. Based on the following criteria: Criteria: Length: FISHTYPE - Cat Fish <10:...
Create a program that when run, prompts the user to enter a city name, a date,...
Create a program that when run, prompts the user to enter a city name, a date, the minimum temperature and the maximum temperature. Calculate the difference between the maximum temperature and the minimum temperature. Calculate the average temperature based on the minimum and maximum temperature. Print out the following: City name today's Date minimum temperature maximum temperature average temperature difference between minimum and maximum The following is a sample run, user input is shown in bold underline. Enter City Name:...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT