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
The block of code below is supposed to display “multiple of 5” if the positive number value is in fact a multiple of 5
12345 [234]

Answer:

Answer is (value MOD 5) = 0.

Explanation:

A number A is multiple of another number B  if after dividing A by B remainder value is zero.

In mathematics modulo or (MOD) function is a function which returns remainder value after dividing two numbers.

Here in question for condition

( value MOD 5 ) = 0 code will print "Multiple of 5". For each value which is divisible by 5 we will get zero remainder implying that value is a multiple of 5.

3 0
3 years ago
As Juan sat in his biology lab, his instructor was droning on about the techniques of vivisection. Juan kept thinking about the
MaRussiya [10]

Answer:

attending

Explanation:

7 0
3 years ago
Suppose you are consulting for a bank that's concerned about fraud detection, and they come to you with the following problem. T
iren [92.7K]

Answer:

Explanation:

( n cards are there initially )

we pick out the first card in random it takes n-1 comparisons to figure out

its Equivalence card - n-1 steps

Two cards have been eliminated ( this leaves us with 2 and n-2 cards)

we pick out the 2nd card in random it takes n-3 comparisons to figure out

its Equivalence card - n-3 steps

we continue to do this.. till all cards are exhausted ( leaves us with 2

and n-4 cards again)

the last comparison will

have

- n-(n-3)

the sum of all these steps - (n-1) + (n-3) + (n-5) + .........+

(n-(n-3))

if you draw this in the form of a tree.

n - n

2

n-2 - n

2

n-4 - n-2

2

n-6 - n-4

2

n-8 - n- 6

the height of the tree will be log n , sum @ each level is at most n

8 0
3 years ago
Your mothers date of birth and a unique personal identification number (pin) code provide authentication by _____.
Semenov [28]
Hello <span>Madysonhenders2477 </span><span>

Answer: Your mothers date of birth and a unique personal identification number (pin) code provide authentication by What you are (C)

Since your identification is about who you are, this would be the answer.

Hope This Helps!
-Chris</span>
6 0
3 years ago
Create a flowchart that assigns a counselor to a student.
Nataly [62]
Please Help! Unit 6: Lesson 1 - Coding Activity 2
Instructions: Hemachandra numbers (more commonly known as Fibonacci numbers) are found by starting with two numbers then finding the next number by adding the previous two numbers together. The most common starting numbers are 0 and 1 giving the numbers 0, 1, 1, 2, 3, 5...
The main method from this class contains code which is intended to fill an array of length 10 with these Hemachandra numbers, then print the value of the number in the array at the index entered by the user. For example if the user inputs 3 then the program should output 2, while if the user inputs 6 then the program should output 8. Debug this code so it works as intended.

The Code Given:

import java.util.Scanner;

public class U6_L1_Activity_Two{
public static void main(String[] args){
int[h] = new int[10];
0 = h[0];
1 = h[1];
h[2] = h[0] + h[1];
h[3] = h[1] + h[2];
h[4] = h[2] + h[3];
h[5] = h[3] + h[4];
h[6] = h[4] + h[5];
h[7] = h[5] + h[6];
h[8] = h[6] + h[7]
h[9] = h[7] + h[8];
h[10] = h[8] + h[9];
Scanner scan = new Scanner(System.in);
int i = scan.nextInt();
if (i >= 0 && i < 10)
System.out.println(h(i));
}
}
4 0
2 years ago
Read 2 more answers
Other questions:
  • What is microsoft excel
    12·1 answer
  • ​For complex models, analysts can choose computer-based modeling tools that use _____, which includes standard shapes and symbol
    10·1 answer
  • 1. Caches are important to providing a high-performance memory hierarchy to processors. Below is a list of 32-bit memory address
    7·1 answer
  • Marie has never used a word processor. In 3 to 4 sentences, describe how she could benefit from using a word processor to comple
    7·2 answers
  • PLS HELP ILL GIVE BRAINLY) enter the answer) desktop publishing software enables users to create products for print or _________
    12·1 answer
  • You defined a class and saved it as shoe.py.
    5·2 answers
  • Var words = ["apple", "bug","car", "dream", "ear", "food"]
    6·2 answers
  • These 2 questions PLEASEEE (:
    14·1 answer
  • Ok so I’m using a word document and towards the bottom of the page it stops me from moving my text box any further down even tho
    13·2 answers
  • THIS IS TIMED PLS HURRY UP
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!