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
zheka24 [161]
3 years ago
7

Suppose that you have created a program with only the following variables.int age = 34;int weight = 180;double height = 5.9;Supp

ose that you also have a method with the following header:public static void calculate(int age, double size)Which of the following method calls are legal?a. calculate(age, weight);b. calculate(age, height);c. calculate(weight, height);d. calculate(height, age);e. calculate(45.5, 120);f. calculate(12, 120.2);g. calculate(age, size);h. calculate(2, 3);i. calculate(age);j. calculate(weight, weight);
Computers and Technology
1 answer:
Yuri [45]3 years ago
3 0

Answer:

a. calculate(age, weight); // This is legal

b. calculate(age, height); // This is legal

c. calculate(weight, height); // This is legal

d. calculate(height, age); // This is not legal

e. calculate(45.5, 120); // This is not legal

f. calculate(12, 120.2); // This is legal

g. calculate(age, size); // This is not legal

h. calculate(2, 3); // This is legal

i. calculate(age); // This is not legal

j. calculate(weight, weight); // This is legal

Explanation:

a. This is legal because the argument passed are two in numbers and they are integers but the integer for the second parameter can be cast to double.

b. This is legal because the method requires two parameter and two are passed. The method requires integer and double. The passed parameter are integer and double.

c. This is legal because the method requires two parameter and two are passed. The method requires integer and double. The passed parameter are integer and double.

d. This is not legal because even though two parameters were passed. The first one should be int but double was supplied and double cannot be downgraded to int. There is a possible lossy conversion from double to int.

e. This is not legal because even though two parameters were passed. The first one should be int but double was supplied and double cannot be downgraded to int. There is a possible lossy conversion from double to int.

f. This is legal because the method requires two parameter and two are passed. The method requires integer and double. The passed parameter are integer and double.

g. This is not legal because even though two parameters were passed. The first one should be int but the second parameter is not defined before been passed to the calculate method.

h. This is legal because the argument passed are two in numbers and they are integers but the integer for the second parameter can be cast to double.

i. This is not legal because only one parameter was passed instead of two.

j. This is legal because the argument passed are two in numbers and they are integers but the integer for the second parameter can be cast to double.

You might be interested in
Keisha has been asked to give a presentation about a new method for processing customer returns. The first thing she should do i
SVEN [57.7K]

Answer:

The first thing should Keisha does is determine the purpose of the presentation.

Explanation:

If we are giving any presentation then firstly we should determine the purpose of our presentation.

There are typical reasons for giving any presentation such as:

  • Alerting
  • Persuading
  • Inspiring
  • Enjoyable

By clearly defining the purpose you need to capture the attention of your audience and maintain their interest thoroughly across the oral presentation. Three key elements in any oral presentation process include:

  • Planning
  • Writing
  • Completion

4 0
3 years ago
A mobile device you are troubleshooting is experiencing a sharp decrease in performance after an hour of operation. The user pow
Finger [1]

Answer: Close or disable all unused running apps.

Explanation: when unused apps keep runningon the device, it will make the device to keep lagging, thereby reducing it efficiency. But once those apps are disabled or closed and the system is probably restarted, the device will regain it efficiency back.

8 0
3 years ago
Provide instance fields for title, month, and year (for example, "Scientific American", "April", 2020). Each of these should be
miskamm [114]

Answer:

Check the explanation

Explanation:

Note : check attached image for output and program and also note that you're to replace "at" with shift 2 as the brainly text editor can't take the symbol

Program : **************Magzine.java**********************

/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

public class Magzine {

 

//class variable private can not access outside class

private String title;

private String month;

private int year;

 

//parameterized constructor

public Magzine(String title,String month,int year)

{

this.title=title;

this.month=month;

this.year=year;

}

 

//override toString method

"at"Override

public String toString()

{

String detail=title+" "+month+" "+Integer.toString(year);

return detail;//return string of class variable

}

 

//get Magzine objecte

 

public boolean equals(Magzine obj)

{

//commented returm statement compare string by address so you can uncomment if

//we do not use same string object of String class

//return this.month==obj.month && this.title==obj.title && this.year==obj.year;

//compare two object element if matches return true else false

return (this.month.equals(obj.month)) &&(this.title.equals(obj.title)) && this.year==obj.year;

}

   

}

Program : *************************Main.java****************************

/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

public class Main {

/**

* "at"param args the command line arguments

*/

public static void main(String[] args) {

// TODO code application logic here

Magzine Obj =new Magzine("Scientific American ", "April", 2020); //object of class

Magzine Obj1 =new Magzine("Scientific American ", "April", 2020);//Obj and obj1 is same content data

Magzine Obj2 =new Magzine("Scientific American", "June", 2020); //obj and obj1 same but obj2 different

 

System.out.println(Obj.toString()); //print string of obj

System.out.println(Obj1.toString());//print string of obj1

System.out.println(Obj2.toString());//print string of obj2

 

 

System.out.println(Obj.equals(Obj1)); //obj and obj1 equal and return true

System.out.println(Obj.equals(Obj2)); // obj and obj2 not equal so return false

 

 

}

 

}

Output can be seen below:

4 0
3 years ago
A termination condition in a loop is analogous to________in a recursive method.
Varvara68 [4.7K]

Answer:

b) iteration.

Explanation:

There are various algorithms which are used in computer programming. Iteration is also a type of algorithm which is used to create loops. The instructions are inserted once and then these instructions are repeated to create a loop function.

8 0
3 years ago
Which of the following is a professional organization in the field of IT? Society for the Prevention of Cruelty to Animals (SPCA
Lelu [443]
(IEEE) Is the obvious answer ; no harshness meant in any way
7 0
3 years ago
Read 2 more answers
Other questions:
  • What are the three fundamental elements of an effective security program for information systems?
    11·2 answers
  • A user calls your help desk and says that he is trying to configure his Word document so that the text within his paragraphs is
    15·1 answer
  • Enter the answer.
    11·2 answers
  • . Select the advantages of RAID-5 relative to other RAID schemes. (MAY SELECT MULTIPLE)
    7·1 answer
  • fun fact about London(me): when it comes to relationships she becomes clingy to the person shes dating
    10·1 answer
  • which program monitors the computer by looking for known trouble makers as well as suspicious behavior​
    11·1 answer
  • Choose all stages of the information processing cycle.
    12·2 answers
  • ________ are the symbolic codes used in assembly language?​
    6·1 answer
  • Transitive spread refers to the effect of the original things transmitted to the associate things through the material, energy o
    6·1 answer
  • Verbs in the active and passive voice
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!