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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 01:30, yudayang2012pa9u8p
Consider the following statements: #include #include class temporary { private: string description; double first; double second; public: temporary(string = "", double = 0.0, double = 0.0); void set(string, double, double); double manipulate(); void get(string& , double& , double& ); void setdescription(string); void setfirst(double); void setsecond(double); }; write the definition of the member function set() so that the instance variables are set according to the parameters. write the definition of the constructor so that it initializes the instance variables using the function set() write the definition of the member function manipulate() that returns a decimal number (double) as follows: if the value of description is "rectangle", it returns first * second if the value of description is "circle" it returns the area of a circle with radius first if the value of description is "cylinder" it returns the volume of a cylinder with radius first and height second. hint: the volume of a cylinder is simply the area of the circle at the base times the height. if the value of description is "sphere" it returns the volume of the sphere with radius first. otherwise it returns -1.0;
Answers: 1
image
Computers and Technology, 22.06.2019 06:50, wtfcmd
Match the personality traits with their description
Answers: 1
image
Computers and Technology, 22.06.2019 14:40, coryowens44
For this assignment you have to write a c program that will take an infix expression as input and display the postfix expression of the input. after converting to the postfix expression, the program should evaluate the expression from the postfix and display the result. what should you submit? write all the code in a single file and upload the .c file. compliance with rules: ucf golden rules apply towards this assignment and submission. assignment rules mentioned in syllabus, are also applied in this submission. the ta and instructor can call any students for explaining any part of the code in order to better assess your authorship and for further clarification if needed. problem: we as humans write math expression in infix notation, e. g. 5 + 2 (the operators are written in-between the operands). in computer's language, however, it is preferred to have the operators on the right side of the operands, ie. 5 2 +. for more complex expressions that include parenthesis and multiple operators, a compiler has to convert the expression into postfix first and then evaluate the resulting postfix write a program that takes an "infix" expression as input, uses stacks to convert it into postfix expression, and finally evaluates it. it must support the following operations: + - / * ^ % ( example infix expression: (7-3)/(2+2) postfix expression: 7 3 2 2 result: rubric: 1) if code does not compile in eustis server: 0. 2) checking the balance of the parenthesis: 2 points 3) incorrect postfix expression per test case: -2 points 4) correct postfix but incorrect evaluation per test case: -i points 5) handling single digit inputs: maximum 11 points 6) handling two-digit inputs: 100 percent (if pass all test cases)
Answers: 3
image
Computers and Technology, 22.06.2019 23:30, bri2008
Which of the following is not a symptom of chronic fatigue syndrome
Answers: 2
You know the right answer?
Consider the following class declarations. Remember that a postcondition describes the result of exe...

Questions in other subjects:

Konu
Mathematics, 18.12.2020 03:20
Konu
English, 18.12.2020 03:20
Konu
Mathematics, 18.12.2020 03:20