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
algol [13]
3 years ago
5

Scientists measure an object’s mass in kilograms and its weight in newtons. If you knowthe amount of mass of an object in kilogr

ams, you can calculate its weight in newtons withthe following formula: weight 5 mass 3 9.8
Write a program that asks the user to enter an object’s mass, and then calculates its weight.If the object weighs more than 500 newtons, display a message indicating that it is tooheavy. If the object weighs less than 100 newtons, display a message indicating that it istoo light
Computers and Technology
1 answer:
Phoenix [80]3 years ago
7 0

Answer:

public class WeightCalculator {

   

   private static DecimalFormat df2 = new DecimalFormat("#.##");

   

   public static void main(String args[]){

       //create scanner to receive user input

       Scanner in = new Scanner(System.in);

       //alert user to input mass

       System.out. println("Enter the Mass in Kg");

       //collect the input as a string

       String s = in. nextLine();

       //convert string to double and multiply by 9.8

       Double weight = Double.valueOf(s)* 9.8;

       

       //Print out answer formatted to 2 decimal place

       System.out. println("The Weight is " + df2.format(weight) + "N");

       

       //conditional statement to check if weight is less than 100

       if (weight < 100){

           System.out. println("Oops, it is too light");

       }

       //conditional statement to check if weight is more than 500

       if (weight > 500){

           System.out. println("Oops, it is too heavy");

       }            

   }

}

You might be interested in
You have a 20-bit network part and a 4-bit subnet part. How many hosts can you have per subnet?
Ymorist [56]

Answer:

tiddies

Explanation:

sukk

3 0
3 years ago
1.6<br> What do you call the two parts of the lift that goes down a mine?
Likurg_2 [28]

Answer:

Sheave wheel and hoist cable

Explanation:

The sheave wheel is a pulley wheel that sits above the mine shaft. The hoist cable passes over the sheave wheel and then down the shaft of the mine. The sheave wheel reduces the sliding friction of the mine cable. The head frame is the structure that supports the sheave wheel.

7 0
3 years ago
What's the problem with this code ?
Svet_ta [14]
Hi,

I changed your program using some of the concepts you were trying to use. Hopefully you can see how it works:

#include <string>
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
   short T;
   cin >> T;
   cin.ignore();

   string str[100];

   for(int i=0; i<T; i++)
   {
      getline(cin, str[i]);
   }

   for (int i = 0; i < T; i++)
   {
      stringstream ss(str[i]);
      string tmp;
      vector<string> v;

      while (ss >> tmp)
      {
          // Let's capitalize it before storing in the vector
          if (!tmp.empty())
          {
              transform(begin(tmp), end(tmp), std::begin(tmp), ::tolower);
              tmp[0] = toupper(tmp[0]);
           }
           v.push_back(tmp);
        }

        if (v.size() == 1)
        {
           cout << v[0] << endl;
        }
        else if (v.size() == 2)
        {
           cout << v[0][0] << ". "  << v[1] << endl;
        }
        else
        {
            cout << v[0][0] << ". " << v[1][0] << ". " << v[2] << endl;
        }
    }

     return 0;
}

4 0
3 years ago
Why is it preferable to code web pages in html format?
Ronch [10]
Depends on what you are working on.

If you are working on a website I recommend Adobe Dreamweaver CC.

if its small assignments that doesnt involve major work, I'd use something like notepad++
8 0
3 years ago
Read 2 more answers
Jordan likes to use his smartphone in his car. He uses it as a navigation device and connects it via Bluetooth to listen to musi
Levart [38]

Answer:

I think A Bluetooth receiver is causing the smartphone to over heat

8 0
2 years ago
Other questions:
  • Select the correct answer.
    6·1 answer
  • A patent facilitates a government-approved technological monopoly by
    5·1 answer
  • an object or device outside the computer, that one would plug into a port to control the functions of a computer are?
    9·2 answers
  • How could a system be designed to allow a choice of operating systems from which to boot? What would the bootstrap program need
    14·1 answer
  • Write a program that lets the user enter a nonnegative integer then uses a loop to calculate the factorial of that number. Displ
    11·1 answer
  • In addition to telling you which programs are currently running, what other information does the task bar display
    10·1 answer
  • Q. Which protocol would best serve to authorize users to access directory services?
    8·1 answer
  • In your own words, describe how a network administrator can use the OSI model to isolate a network problem.
    13·1 answer
  • What is the difference between the wiring configurations for a residential, 8-position, 8-contact (8P8C) modular plug and jack i
    9·1 answer
  • You want to add a caption to a table. which tab contains this option?.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!