Sarting out with visual basic 2012,6th ed. book -chapter 4 Programming challenge
ID: 3866148 • Letter: S
Question
Sarting out with visual basic 2012,6th ed. book -chapter 4
Programming challenge #13 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 a VB application that lets the user enter an object's mass and calculate its weight. If the objects weighs more than 1000 newtons, dislay 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.
I would like to know creating this program in visual basic in step by step proccess.
Thank you.
Explanation / Answer
#///////ALGORITHIM START/////
#1 get input from user then store in mass variable
#2 perform weight function calculation Weight = Mass × 9.8
#3 if elif else function
#4 if weight > 1000 "the object is too heavy"
#5 elif weight < 10 "the object is too heavy", weight, newtons
#6 else "the weight of the object is", weight, "kilograms."
#7 goodbye
#///////ALGORITHIM END/////
# IF ma
# Error the number you have entered is not in the range of 1-10
# Elif var = 1
# display I
# Elif var = 2
# display II
# Elif var = 10
# display X
#END IF
# MAIN MODULE
#getInput Module
mass = input(int("Please enter the "))
#//////end input
#/////////formula start
Weight=Mass × 9.8
#/////////formula end
#decisionPiece Module
if(weight > 1000):
print("The weight is too heavy.")
elif(weight < 10):
print("The weight is too light.")
else():
print("The weight of this object is", weight, "Kilograms.")
print ("Good bye!")
hope above logic and code wil help you
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.