have to take the height of a person and calculate it into millimeters how do i go about doing that?!
16 5012
have to take the height of a person and calculate it into millimeters how do i go about doing that?!
without using a msgbox.
have to take the height of a person and calculate it into millimeters how do i go about doing that?!
do you mean the height in feet??
well since 1 feet = 304.8 mm
if you dont want a msgbox, lets say you have 2 txt boxes and a commandbutton that should say something like this:
textbox2.text= textbox1.text * 304.8
HTH
do you mean the height in feet??
well since 1 feet = 304.8 mm
if you dont want a msgbox, lets say you have 2 txt boxes and a commandbutton that should say something like this:
textbox2.text= textbox1.text * 304.8
HTH
doing the code in a console application
doing the code in a console application
Can you give us some idea of what you actually want help with? For instance, entering the information into your program, doing the calculation to mm (from what)? And so on.
And what version of VB are you using?
Can you give us some idea of what you actually want help with? For instance, entering the information into your program, doing the calculation to mm (from what)? And so on.
And what version of VB are you using?
I am using VB 2005
I need help with how to start the code! I have no clue of what to type to start. I wrote the code for the person to enter their height in feet and inches, and now I have to write the code to calculate it to millimeters, and I have no idea how to start. Or what key words to use.
So you have the Feet and Inches stored?
If so, here's how you can convert them to millimeters.
I'll pretend your two variables so far are called vHeightFeet and vHeightInches, so change my code to suit what you've actually called them.
[code=vb]
Dim vHeightmm As Double
'We prepared a new variable in which to hold the converted length in mm
vHeightmm = (vHeightFeet + (vHeightInches/12)) * 304.8
'We just converted Feet+Inches into mm and stored it in the vHeightmm variable
EXPLANATION:
Kadghar said that 1ft = 304.8mm
So we want to know how many feet and inches there are, in feet only.
Since there are 12 inches in a foot, if we divide the inches by 12, we get that equivalent length in feet (i.e. a decimal value less than 1).
This, plus the number of feet, equals the number of feet 'in decimal'.
Example: 1 foot 6 inches 6 inches divided by 12 = 0.5 feet 1 foot + 0.5 feet = 1.5 feet = 1 foot 6 inches 'in decimal'
Then we multiply this final value - 1.5 - by 304.8 to convert it to milimeters, and store it in variable vHeightmm.
This variable is declared as a 'Double' data type, meaning a number which can get very big, and have very accurate decimal points.
...Right, the strange 'blank post' bug on this forum cropped up again, so I'll try again:
So you have the Feet and Inches stored?
If so, here's how you can convert them to millimeters.
I'll pretend your two variables so far are called vHeightFeet and
vHeightInches, so change my code to suit what you've actually called them. -
Dim vHeightmm As Double
-
'We prepared a new variable in which to hold the converted length in mm
-
-
vHeightmm = (vHeightFeet + (vHeightInches/12)) * 304.8
-
'We just converted Feet+Inches into mm and stored it in the vHeightmm variable
-
EXPLANATION:
Kadghar said that 1ft = 304.8mm
So we want to know how many feet and inches there are, in feet only.
Since there are 12 inches in a foot, if we divide the inches by 12, we get that equivalent length in feet (i.e. a decimal value less than 1).
This, plus the number of feet, equals the number of feet 'in decimal'.
Example: 1 foot 6 inches
6 inches divided by 12 = 0.5 feet
1 foot + 0.5 feet = 1.5 feet = 1 foot 6 inches 'in decimal'
Then we multiply this final value - 1.5 - by 304.8 to convert it to milimeters, and store it in variable vHeightmm.
This variable is declared as a 'Double' data type, meaning a number which can get very big, and have very accurate decimal points.
...Right, the strange 'blank post' bug on this forum cropped up again, so I'll try again:
So you have the Feet and Inches stored?
If so, here's how you can convert them to millimeters.
I'll pretend your two variables so far are called vHeightFeet and
vHeightInches, so change my code to suit what you've actually called them. -
Dim vHeightmm As Double
-
'We prepared a new variable in which to hold the converted length in mm
-
-
vHeightmm = (vHeightFeet + (vHeightInches/12)) * 304.8
-
'We just converted Feet+Inches into mm and stored it in the vHeightmm variable
-
EXPLANATION:
Kadghar said that 1ft = 304.8mm
So we want to know how many feet and inches there are, in feet only.
Since there are 12 inches in a foot, if we divide the inches by 12, we get that equivalent length in feet (i.e. a decimal value less than 1).
This, plus the number of feet, equals the number of feet 'in decimal'.
Example: 1 foot 6 inches
6 inches divided by 12 = 0.5 feet
1 foot + 0.5 feet = 1.5 feet = 1 foot 6 inches 'in decimal'
Then we multiply this final value - 1.5 - by 304.8 to convert it to milimeters, and store it in variable vHeightmm.
This variable is declared as a 'Double' data type, meaning a number which can get very big, and have very accurate decimal points.
when i do that all it gives me back is the numbers that i input!
here is the snippet of code that i have wrote -
Console.WriteLine("Enter your height in feet")
-
vheightfeet = Convert.ToDouble(Console.ReadLine())
-
-
Console.WriteLine("Enter your inches from your height")
-
vheightinches = Convert.ToDouble(Console.ReadLine())
-
-
vheightmm = (vheightfeet + (vheightinches / 12)) * 304.8
-
Console.WriteLine(vheightfeet & " " & vheightinches)
when i do that all it gives me back is the numbers that i input!
here is the snippet of code that i have wrote
Console.WriteLine("Enter your height in feet")
vheightfeet = Convert.ToDouble(Console.ReadLine())
Console.WriteLine("Enter your inches from your height")
vheightinches = Convert.ToDouble(Console.ReadLine())
vheightmm = (vheightfeet + (vheightinches / 12)) * 304.8
Console.WriteLine(vheightfeet & " " & vheightinches)
Try
Console.WriteLine((vheightfeet + vheightinches/12) *304.8 & " mm")
Hope that helps
Try
Console.WriteLine((vheightfeet + vheightinches/12) *304.8 & " mm")
Hope that helps
i keep getting a InnerException now when i do that
When I do that all it gives me back is the numbers that I input!
Well, of course it does - you told it to. :) Your last line probably should be something like... - Console.WriteLine(vheightmm & " mm")
i keep getting a InnerException now when i do that
have you tried this?
dim vheightmm as double
vheightmm = (vheightfeet + (vheightinches / 12)) * 304.8
Console.WriteLine(vheightmm)
...Right, the strange 'blank post' bug on this forum cropped up again, so I'll try again:
I tried editing your post, and it looks as though the problem appears because you failed to close your CODE tag. Which is odd, because when I accidentally did the same thing just now, it just didn't bother with the colour-coding and so on. It seems to be playing favourites.
have you tried this?
dim vheightmm as double
vheightmm = (vheightfeet + (vheightinches / 12)) * 304.8
Console.WriteLine(vheightmm)
yes thank you, that worked!
i am sure i will be back with more question! about diffrent things
Good to know you're able to get it to work in the end. =)
I tried editing your post, and it looks as though the problem appears because you failed to close your CODE tag. Which is odd, because when I accidentally did the same thing just now, it just didn't bother with the colour-coding and so on. It seems to be playing favourites.
Ah! I didn't realize. But the thing which happened for you is the same thing which normally happens to me too
- i.e. it just literally displaying the CODE tag, not formatting the code. Strange. =/
... But the thing which happened for you is the same thing which normally happens to me too - i.e. it just literally displaying the CODE tag, not formatting the code. Strange. =/
I think it might have something to do with how close it is to the end of the message.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: maceo |
last post by:
I have some code that extracts the data from a table and performs a
calculation (total time) on one of the columns.
Here is the code:
<?php
/* Database connection */
|
by: Gas |
last post by:
I am new to C#, I want to perfoem a calculation and I have a weird out come
from the app.
Here is the code
double percentage = 0;
percentage = ctrl1.Height / (ctrl1.Height+ ctrl2.Height)
...
|
by: Gas |
last post by:
I am new to C#, I want to perfoem a calculation and I have a weird out come
from the app.
Here is the code
double percentage = 0;
percentage = ctrl1.Height / (ctrl1.Height+ ctrl2.Height)
...
|
by: GD1 |
last post by:
Dear developers,
is there any way I can calculate the height in millimeters of a font at
a certain size?
Thank you in advance.
|
by: Erich Meier |
last post by:
Hello there,
is there any way to set the size of images or table cells in HTML not by
pixels but by inches or in millimetres?
The problem behind this is that you never know what kind of output...
|
by: dtmfcc |
last post by:
My website is at www.simi-therapy.com
My CSS is at http://www.simi-therapy.com/simitherapy-screen.css
Question -- on the dark blue bar under the beach image, one change
caused another...
|
by: zandiago |
last post by:
#include <cstring>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <fstream>
#include <string>
#include <ctime>
using namespace std;
|
by: mrking |
last post by:
Hi,
First time in the Java section here.
I have an HTML form and a PHP script to do a simple calculation but it has to take me to a different page for the results.
The calculator is really...
|
by: Keith G Hicks |
last post by:
I have the following code which runs fine
Imports System.Drawing
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |