Answer:
Explanation:
The following code is written in Java. It creates the interface/prototype, the function, and the main method call. The function takes in the three int parameters, adds them, and then checks if the sum equals zero, outputting the correct boolean value. Output can be seen in the picture attached below. Due to technical difficulties I had to add the code as a txt file below.
Answer:
To delete a question you asked, click the arrow in the top right-hand corner of your question page and select Delete. If any answers have been added to your question, you'll have to request its deletion.Explanation:
Answer:
import java.util.Scanner;
public class num8 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Enter the mass");
double mass = in.nextDouble();
double weight = calWeight(mass);
System.out.println("The weigth is "+weight);
}
static double calWeight(double mass){
double weight = mass*9.80665; // assume a = accelation due to gravity = 9.80665N
if(weight>500){
System.out.println("Too Heavy");
}
else if(weight<100){
System.out.println("Too Light");
}
return weight;
}
}
Explanation:
- Using Java programming language
- The main method is created to request and store a variable, mass in kilogram. The main method call calWeight() and passes the value for mass
- A method calWeight() is created that calculates the weight in newtons (mass * 9.8).
- The method checks if the weight is greater than 500 (prints too heavy) if less than 100(prints to light)
- Returns the weight