3.5. Mass and Weight - Java

in #programming10 years ago

Starting out with Java: From control structures through objects

Chapter 3

Programming Challenges

5. Mass and Weight 

Scientists measure an object’s mass in kilograms and its weight in Newtons. If you know the amount of mass that an object has, you can calculate its weight, in Newtons, with the following formula: 

Weight = Mass x 9.8

Write a program that asks the user to enter an object’s mass, and then calculate its weight. If the object weighs more than 1,000 Newtons, display a message indicating that it is too heavy. If the object weighs less than 10 Newtons, display a message indicating that the object is too light.

Gaddis, Tony (2015-05-29). Starting Out with Java: From Control Structures through Objects (Page 185). Pearson Education. 

Kindle Edition. 

Happy Steeming Everyone! :)

Coin Marketplace

STEEM 0.04
TRX 0.32
JST 0.081
BTC 61240.63
ETH 1620.29
USDT 1.00
SBD 0.42