Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

hello chegg expert please it's urgent and very very important for me please help me and give me the answers of all the questions I

hello chegg expert please it's urgent and very very important for me please help me and give me the answers of all the questions I don't have enough time please please.

image text in transcribed

image text in transcribed

1. Write a program to calculate the midpoint of two 2D coordinate points. (1) Among them, the Point class represents two-dimensional coordinate points, and has private member variables x and y, representing the values of the abscissa and ordinate, initialized by the constructor. 7pts (2) Four methods setX(), getX (),sexY(),getY() are used to set and obtain the coordinates. In addition, a member method midPoint (Point p), which takes a Point object as a parameter, calculates the midpoint of the two coordinates, and returns a new two-dimensional point. 8pts It is required to reflect the encapsulation characteristics in the program. Instantiate two two-dimensional points (4,5) and (6,8) in the main function of the class Test. Calculate the midpoint of the two by calling the midPoint of one of them and return a new two-dimensional point, and outputs the x and y of the new point. 2. Write the following method that returns true if the list is already sorted in increasing order. public static boolean isSorted(int[] list) 10pts Write a test program that prompts the user to enter a list and displays whether the list is sorted or not. Here is a sample run. Note that the first number in the input indicates the number of the elements in the list. This number is not part of the list

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

Students also viewed these Databases questions

Question

Explain the role of intermediate result variables.

Answered: 1 week ago