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
Eddi Din [679]
3 years ago
5

Write a program that asks the user to enter an object’s mass, then calls a // function to return the object's weigh in newtown.

If the object weighs // more than 500 newtons, the function also displays a message indicating that // it is too heavy. If the object weighs less than 100 newtons, the function // also displays a message indicating that it is too light.
Computers and Technology
1 answer:
lisov135 [29]3 years ago
4 0

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  

You might be interested in
Where is the Outlook Search Folder located?
melamori03 [73]
When you go to the mail go to file and click new it should be in there as search folder
6 0
3 years ago
what is the worst-case big o running time for finding the maximum value in an array of size n by scanning from left to right and
Aleksandr-060686 [28]

Answer:

spanish

Explanation:

no ingles a me pisquen spanish soy tu amigos teacher

6 0
1 year 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
Calcule la carga que puede levantar un cabrestante si la manivela mide 40 cm y el El radio del molinete es una tercera parte de
Luda [366]

Answer:

C

Explanation:

because...

5 0
2 years ago
The Java compiler does not check for an ArrayIndexOutorBoundsException during the compilation of a program containing arrays. O
yulyashka [42]

Answer:

TRUE

Explanation:

  • Let us first understand what is an ArrayIndexOutOfBounds Exception.
  • As the name itself suggests the index for the array has gone out of bound (permissible value) and an exception (anamoly) is resulted.
  • So, it throws an error.
  • That means if an array, Employee of size n is defined then the permissible elements are Employee[0] to Employee[n-1]. If any negative index or with the index is greater than n-1 is tried to access it throws an error saying ArrayIndexOutOfBounds Exception.
  • In java, during the compilation of the program the compiler doesn't check for the ArrayIndexOutOfBounds Exception.It checks during running the program.
  • So, it is called a Runtime Exception.
7 0
3 years ago
Other questions:
  • The OSI model is a useful tool in troubleshooting a network because it enables you to isolate a problem to a particular software
    11·1 answer
  • What is the difference between head header and heading in HTML​
    8·1 answer
  • A prime number is an integer that is divisible only by 1 and by itself. Write a program that: 1. Takes a number as an input. 2.
    5·1 answer
  • Premise: Tracy has a file that contains a list of actors and the movies in which they acted. She wants to know the top 3 ranked
    8·1 answer
  • Digital on a smart phone means the camera is actually zooming in on the photo itself not the subject that you are shooting true
    8·1 answer
  • What is the range for copper tape
    15·1 answer
  • All parking revenue comes from a home teams games? True or false
    5·1 answer
  • Ema Company for business .
    14·1 answer
  • I need help now with YT
    7·2 answers
  • which endpoint application runs on an endpoint device that only detects an attack in an endpoint device? chqgg
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!