Java Methods and References and Perfect and Oversized Arrays. Please Help! 2. (2
ID: 3915827 • Letter: J
Question
Java Methods and References and Perfect and Oversized Arrays. Please Help!
2. (2 points each) Write the necessary code to call these methods based on the signatures below. Each of these method signatures belongs to the Computer class. boolean ping(String macAddress, int retries) //Done for you as an example Computer cat new ComputerO boolean catch cat.ping("blah", 3); a. b. void restart(String machineName) c. static void restart(String machineName) d. void updateAllWindowsMachines0 e. static void updateAllWindowsMachines0 f. static boolean ping(String macAddress, int retries)Explanation / Answer
Solution 2:
/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
class Computer{
//function 1
boolean ping(String macaddr, int retries){
System.out.println(" From bool ping");
return true;
}
//function 2
void restart(String machinename){
System.out.printf( " From void restart: ", machinename);
}
//function 3
static void restart(String machinename){
System.out.printf(" From static void restart: ", machinename);
}
//function 4
void updateAllwinmachine(){
System.out.println(" From void updateallwinmachine");
}
//function 5
static void updateAllwinmachine(){
System.out.println(" From static void updateallwinmachine");
}
//function 6
static boolean ping(String addr, int retries){
System.out.println(" From static boolean ping");
return true;
}
public static void main(String args[]){
Computer cat = new Computer();
boolean temp = cat.ping("blah", 4); //Calling function 1
System.out.printf(": ",temp);
cat.restart("machine 1 "); //Calling function 2
Computer.restart("machine 2" ); //Calling function 3
cat.updateAllwinmachine(); //Calling function 4
Computer.updateAllwinmachine(); //Calling function 5
boolean temp2 = Computer.ping("addr", 3); //Calling function 6
System.out.printf(": ", temp2);
}
}
Solution 3:
3a.
boolean withdraw(double x);
3b.
static boolean withdraw(double x);
3c.
boolean convert(double x, String countrie1, String countrie2 );
3d.
static boolean convert(double x, String countrie1, String countrie2 );
3e.
boolean deposit(double x);
3f.
static boolean deposit(double x);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.