Examlex
class Rectangle
{
int length, breadth;
void show(int x, int y)
{
length = x;
breadth = y;
}
int calculate()
{
return(length * breadth);
}
}
public class EnteredValues
{
public static void main(String[] args)
{
Rectangle rectangle = new Rectangle();
_____________________________
_____________________________
rectangle.show(a, b);
System.out.println("You entered: " + a + " and " + b);
int area = rectangle.calculate();
System.out.println("The area of the rectangle is: " + area);
}
}
In the above program, the area of a rectangle is calculated by using two classes named Rectangle and EnteredValues. In the first class, two methods are used: show(int x, int y) and calculate(). The show() method takes two variables as input, and the calculate() method calculates the area of a rectangle.
In the second class, the main() method is declared. Inside this method, an object of a Rectangle class is created. The user will input two values and store the values in the variables. The entered values will be changed into integers using the parseInt() method. The variables are then passed in the show()method, and the area will be calculated by the calculate() method.
On the lines provided, create the parseInt() method statements to reformat the two String values.
Biomedical Therapy
Treatments for psychological disorders that involve medications, surgical procedures, or other medical interventions.
Cognitive-behavioral Therapies
A group of psychotherapeutic approaches aimed at addressing dysfunctional emotions, behaviors, and thoughts through systematic, goal-oriented procedures.
Behavioral Conditioning
A learning process that involves the association of a stimulus with a specific response, often used in behavior modification techniques.
Psychodynamic Therapy
A therapy that focuses on revealing and resolving unconscious conflicts based on the principles of psychodynamic psychology.
Q1: Which of the following statements will correctly
Q13: A package containing the Arrays class<br>A)ragged array<br>B)bubble
Q22: Explain what is needed to declare a
Q26: The _ method is always called after
Q27: If a method throws an exception that
Q33: InputStream is a child of FileInputStream.
Q36: You do not use the java command
Q39: In a(n) _ program, the user might
Q51: When you declare a variable of a
Q63: Clicking a component results in a(n) _.<br>A)