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
Is it possible build a real time machine?
Helga [31]

Answer:

Travelling in time might sound like a flight of fancy, but some physicists think it might really be possible. BBC Horizon looked at some of the most promising ideas for turning this staple of science fiction into reality.

Explanation:

7 0
2 years ago
Read 2 more answers
The process of changing a program’s internal structure without changing the way the program works is ______________.
aev [14]

Explanation: changing the coding and not the way it works.

7 0
3 years ago
Which component is a part of the central processing unit (CPU) of a computer
suter [353]
The arithmetic logic unit (ALU), which performs arithmetic and logical operations.

The control unit (CU), which extracts instructions from memory and decodes and executes them, calling on the ALU when necessary.

6 0
3 years ago
Read 2 more answers
When you build a computer from parts, you usually start by deciding on which processor and motherboard you will use?
loris [4]
The thing to look for is compatible RAM, Processor and motherboard. Then I would choose my graphics card, hard drive, etc.
3 0
3 years ago
How does electricity work in phones?
kati45 [8]
Great Question! So the plug will go into the wall and electricity will hit the cord and power through the cord into the charger (Cordless) Now if you talking mobile phones such as iPhones. The battery powers wire and hardware to power your little mobile phone! Hope this helps.
8 0
3 years ago
Other questions:
  • Connected contacts require___ to open.
    11·1 answer
  • Is a type of bullying that takes place when a person intentionally posts negative information about another that is not true
    8·1 answer
  • If a simple pipelined processor is super-pipelined by a factor of 3 (the ALU takes 3 cycles instead of one for the smallest oper
    15·1 answer
  • Can you get financial aid with average grades
    15·1 answer
  • Using this tool to help you to visualize your slides and develop your content
    13·1 answer
  • What is the meaning of 4 8 15 16 23 42?
    14·1 answer
  • The purpose of the 3030 gas dehydration unit
    11·1 answer
  • Please help me ASAP! Here is the question.
    15·1 answer
  • Test unit 8 edhesive answers ​
    15·1 answer
  • Does anyone have discord
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!