1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
TEA [102]
3 years ago
10

Consider the following class definition.public class Rectangle{private double length;private double width;public Rectangle(){len

gth = 0;width = 0;}public Rectangle(double l, double w){length = l;width = w;}public void set(double l, double w){length = l;width = w;}public void print(){System.out.println(length + " " + width);}public double area(){return length * width;}public void perimeter(){return 2 length + 2 width;}}Suppose that you have the following declaration.Rectangle bigRect = new Rectangle();
Which of the following sets of statements are valid in Java?
(i) bigRect.set(10, 5);
(ii) bigRect.length = 10;bigRect.width = 5;
Computers and Technology
1 answer:
fredd [130]3 years ago
7 0

Answer:

The answer is "Option (i)".

Explanation:

In the given java code a class is defined that name is "Rectangle" inside a class two global private double datatype variable is defined that is "length and width". A default constructor is defined that contains the value of private variables. In the next line, a parameterized constructor and a set function is defined that contain the parameter values. Then three function is defined that is "print, area, and perimeter" in which print function prints value and area, perimeter function calculate values.

  • Option (i) is correct because it is the correct way to call the function.
  • Option (ii) is incorrect because the private member does not accessible outside the class.

You might be interested in
What is modularity?
My name is Ann [436]

Answer:

Option D

Explanation:

Modularity in general defines the flexibility of a system. It is the degree to which a system can be broken down into smaller segments and then rearranged or recombines into new groups. Modularity is determined for multiple disciplines each having their own drawbacks.

8 0
3 years ago
Which Creative Commons license type allows others to use and build upon work non-commercially, provided that they credit origina
Vera_Pavlovna [14]

Answer:

Creative Commons license type allows others to use and build upon work non-commercially, provided that they credit original author and maintain the same licensing is described below in detail.

Explanation:

Attribution-Non financially-ShareAlike

This permission lets others adapt, remix, and develop upon your work non-financially, as long as they charge you and license their new inventions under identical times. There are six separate license classes, scheduled from most to least licensed. the material in any mechanism or arrangement, so long as attribution is given to the originator.

8 0
3 years ago
An important result of the development of anesthesia was?
Ksju [112]
It could be #2 since the patient would be asleep under the anesthesia they would be able to perform amputations more often since the patient would not be able to feel the pain during the procedure. It could also be #3 because if the patient is asleep you could use a more direct approach instead of avoiding certain procedures that would put the patient in a lot of pain if it was performed while they were awake. In all I would say the answer is #2, please comment which is the right answer, thank you.
7 0
4 years ago
Write a program that sorts an array of 10 integers using bubble sort. In the bubble sort algorithm, smaller values gradually “bu
blsea [12.9K]

Answer:

#include<iostream>

using namespace std;

int main(){

   //initialization

  int arr1[10] = {2,4,6,1,7,9,0,3,5,8};

  int temp;

   int size_arr;

   //nested for loop

  for(int i=0;i<size_arr-1;i++){

   for(int j=0;j<size_arr-i-1;j++){

       if(arr1[j]>arr1[j+1]){ //compare

               //swapping

           temp = arr1[j];

           arr1[j]=arr1[j+1];

           arr1[j+1]=temp;

       }

   }

  }

  //display the each element

  for(int i=0;i<10;i++){

   cout<<arr1[i]<<" ";

  }

    return 0;

}

Explanation:

Create the main function and declare the variable and defining the array with 10 values.

take the nested for loop, nested loop means loop inside another loop.

the outer loop traverse in the array from 0 to size-1.

and inside loop traverse from 0 to size -i-1, because for every cycle of the outer loop the one element is sorted at the end. so, we do not consider the element from the last for every cycle of the outer loop. That's why (size-i-1)

In the bubble sort, the first element compares with the second element and if the first id greater than the second then swap the value. so, for the above algorithm, we take the if statement and it checks the condition if the condition becomes true then the swap algorithm executes.

we take a third variable for swapping. after that, if the outer loop condition false it means all elements will traverse and then the loop will terminate.

and finally, take another for loop and display the output.

8 0
4 years ago
How does a MIPS Assembly procedure return to the caller? (you only need to write a single .text instruction).
AnnyKZ [126]

Answer:

A MIPS Assembly procedure return to the caller by having the caller pass an output pointer (to an already-allocated array).

8 0
4 years ago
Other questions:
  • Microsoft Surface can do all of the following except ______.
    12·2 answers
  • On an Android device, where can a user find the correct app to use to sync contacts and apps among devices?
    10·1 answer
  • What is Livvyo? Livvyo review
    8·1 answer
  • Explain the importance of mobile computing in communication​
    7·2 answers
  • A user who enters americanbank.net into a web browser instead of the correct americanbank and is then taken to a fake look-alike
    11·2 answers
  • Advanced Electronics has employees who use a company website to share work. By posting on the website, employees are
    7·1 answer
  • PLS ANSWER. MARKING CORRECT ANSWER AS BRAINLIEST
    11·1 answer
  • The National Vulnerability Database (NVD) is responsible for actively performing vulnerability testing for every company's softw
    8·1 answer
  • Describe the layout of an article on Wikipedia​
    7·1 answer
  • Which description best applies to a macro?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!