Question

Create Visual Basic projects to solve Programming Challenges 14 - Mass and Weight Scientists measure an...

Create Visual Basic projects to solve Programming Challenges 14 - Mass and Weight

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

Weight=mass*9.8

Create VB application that lets the user enter an object's mass and calculates its weight. If the object weighs more than 1000 newtons, display a message indicating that it is too heavy. If the object weighs less than 10 newtons, display a message indicating that it is too light.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Calculation of weight using mass:

Formula: Weight = mass * 9.8

C# Code:

using System;
class HelloWorld {
  static void Main() {
      Console.WriteLine("Enter mass of the object in Kilograms");
      double mass=Convert.ToDouble(Console.ReadLine());
      Console.WriteLine("Mass of given object is: "+mass+"kg");
      double weight=mass*9.8;
      Console.WriteLine("Weight calculated from mass is: "+weight+"N");
      if(weight>1000){
          Console.WriteLine("The object is too heavy");
      }
      if(weight<10){
          Console.WriteLine("The object is too light");
      }
  }
}

The above code asks mass as user input and converts it into weight. If weight is >1000N it prints as heavy and if weight is <10N it prints as light.

Add a comment
Know the answer?
Add Answer to:
Create Visual Basic projects to solve Programming Challenges 14 - Mass and Weight Scientists measure an...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I need Notebook++ coding! Thanks so much I will upvote! <!DOCTYPE html> <html> <body> <!-- replace...

    I need Notebook++ coding! Thanks so much I will upvote! <!DOCTYPE html> <html> <body> <!-- replace the text below with your name!-->    <!-- -->    <!-- -->    <title> Jason Kidwell</title> <script> // // Scientists measure an object’s mass in kilograms and its weight in newtons. // If you know the amount of mass of an object in kilograms, you can calculate // its weight in newtons with the following formula: // //       weight=mass×9.8 // // Write a...

  • (10pts).   Consider the following: void fun1(void); void fun2(void); void fun3(void); void main() {    Int a,b,c;...

    (10pts).   Consider the following: void fun1(void); void fun2(void); void fun3(void); void main() {    Int a,b,c;    … } void fun1(void){    Int b,c,d;    … } void fun2(void){    Int c,d,e;    … } void fun3(void){    Int d,e,f;    … } Given the following calling sequences and assuming that dynamic scoping is used. What variables are visible during execution of the last function called? Include with each visible variable the name of the function in which it was...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT