subject

Consider the following class declarations. Remember that a postcondition describes the result of executing a method. public class Point
{
private double myX;
private double myY;

//postcondition: this Point has coordinates (0, 0)
public Point()
{ /* implementation not shown */ }

//postcondition: this Point has coordinates (x, y)
public Point(double x, double y)
{ /* implementation not shown */ }

//other methods not shown
}

public class Circle
{
private Point myCenter;
private double myRadius;

//postcondition: this Circle has center at (0, 0) and radius 0.0
public Circle()
{ /* implementation not shown */ }

//postcondition: this Circle has the given center and radius
public Circle(Point center, double radius)
{ /* implementation not shown */ }

//other methods not shown
}
In a separate tester program/class, which of the following correctly declares and initializes Circle circ with center at (29.5, 33.0) and radius of 10.0?

A.
Circle circ = new Circle(29.5, 33.0, 10.0);
B.
Circle circ = new Circle((29.5, 33.0), 10.0);
C.
Point p = new Point(29.5, 33.0);
Circle circ = new Circle(p, 10.0);
D.
Circle circ = new Circle();
circ. myCenter = new Point(29.5, 33.0);
E.
Circle circ = new Circle();
circ. myCenter = new Point();
circ. myCenter. myX = 29.5;
circ. myCenter. myY = 33.0;
circ. myRadius = 10.0;

D
E
B
C
A

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 07:00
You will be given two character arrays of the same size, one will contain a number of ships. ships will move around the character array based on which way they are facing and the route they are on. routes are given in the other array. the route consists of '-' and '|' for straight paths, '\' and '/' for curves, and '+' for intersections. there are ships on these routes. ships always face a direction, '^' for up, '> ' for right, 'v' for down, and '< ' for left. any time the ships hit a '\' or a '/' it will turn as you would expect a ship to turn (e.g. a '^' that moves into a '/' will turn right). at an intersection, ships will always continue straight through. all ships move at the same speed, ships take turns moving and all ships move during one 'tick'. the one in the most top left goes first, followed by those to its right, then the ones in the next row. it iterates along the rows and then down the columns. each ship moves one space on its turn moving along the route. your function needs to return the position of the first collision between two ships and the number of ticks before the crash occurred.
Answers: 2
question
Computers and Technology, 23.06.2019 15:30
Brian wants to conduct an online search with a certain phrase. he intends to use the words books that belong to the 1800s in his search. how should he use the word that in his search?
Answers: 1
question
Computers and Technology, 23.06.2019 19:30
You can apply several different worksheet themes from which tab?
Answers: 1
question
Computers and Technology, 24.06.2019 04:30
Write and test a python program to find and print the largest number in a set of real (floating point) numbers. the program should first read a single positive integer number from the user, which will be how many numbers to read and search through. after reading in all of the numbers, the largest of the numbers input (not considering the count input) should be printed.
Answers: 1
You know the right answer?
Consider the following class declarations. Remember that a postcondition describes the result of exe...
Questions
question
Mathematics, 30.06.2019 03:30
question
Geography, 30.06.2019 03:30
question
Mathematics, 30.06.2019 03:30
question
Mathematics, 30.06.2019 03:30
Questions on the website: 13722367