// Haroon Achackzad CS1A Chapter 4, P. 220, #6
//
/**************************************************************
*
* Mass and Weight
* ____________________________________________________________
* This program asks a user to enter a mass in between 10-1000 Newtons
* and to calculate the weight of that object through user input within
* range.
*
* Computation is based on the formula:
* Weight= Mass* 9.8
* ____________________________________________________________
* INPUT
* mass= Force of Gravity on an object
*
* OUTPUT
* weight: product of mass *9.8
*
**************************************************************/
#include <iostream>
using namespace std;
int main() {
//variables
float weight,
mass;
// Make user enter the Object's mass
cout << endl;
cout << "What is the object's mass: ";
cin >> mass;
// Calculation for Weight
weight = mass * 9.8;
//Show weight on display
cout << "\nObject's weight = ";
cout << weight << endl << endl;
if (weight >= 1000)
cout << "too heavy. ";
else if (weight <= 10)
cout << "too light. ";
else
cout << "Neither Heavy or too light. ";
cout << endl << endl;
return 0;
}
Ly8gSGFyb29uIEFjaGFja3phZCBDUzFBIENoYXB0ZXIgNCwgUC4gMjIwLCAjNgovLwovKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKICoKICogTWFzcyBhbmQgV2VpZ2h0CiAqIF9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXwogKiBUaGlzIHByb2dyYW0gYXNrcyBhIHVzZXIgdG8gZW50ZXIgYSBtYXNzIGluIGJldHdlZW4gMTAtMTAwMCBOZXd0b25zCiAqIGFuZCB0byBjYWxjdWxhdGUgdGhlIHdlaWdodCBvZiB0aGF0IG9iamVjdCB0aHJvdWdoIHVzZXIgaW5wdXQgd2l0aGluCiAqIHJhbmdlLgogKgogKiBDb21wdXRhdGlvbiBpcyBiYXNlZCBvbiB0aGUgZm9ybXVsYToKICogV2VpZ2h0PSBNYXNzKiA5LjgKICogX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCiAqIElOUFVUCiAqIG1hc3M9IEZvcmNlIG9mIEdyYXZpdHkgb24g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