Distance, Speed, Time Calculator Using Units
07-18-2019, 04:15 AM (This post was last modified: 07-19-2019 11:59 PM by Gene222.)
Post: #1
 Gene222 Member Posts: 105 Joined: Feb 2015
Distance, Speed, Time Calculator Using Units
A distance, speed and time calculator that uses the Units, MKSA, and CONVERT functions of the HP Prime. Enter any two variables and solve for the third.

When solving for the unknown variable, you need to specify the units of the unknown variable. When using h°m′s'' units for time, you need to enter the degrees, minute, and seconds symbols. One hour, 30 minutes and 45 seconds is entered as 1°30′45"

[7/18/19] Added DistSpeedTime_Units4 program, which is a rewrite of the program. This program converts the input values to MKSA units, and then removes the MKSA unit tags before solving for the unknow variable. After the unknown variable is solved, the MKSA unit tag is applied, and the variables are converted back to the users units. This was done because only simple arithmetic equations can be solved with units. This is one way to work around that limitation. Requires software version (2018 10 16) or later. [7/19/19] Corrected the error with the "clear the inputs" in the Solve option. It was clearing the wrong variables.

[7/19/19] Attached is version 5 of the same program. The previous two programs printed the output to the print terminal. This third program shows the results on the INPUT screen. The program loops itself by simply calling the main program and displays the input screen with the answer. To flag the answer, the solved variable flag was added to the variable label of the INPUT statement, as shown below. To exit, press the cancel tab. To clear the inputs, select "clear the inputs" from the "Solved:" selection, and press OK.

Attached File(s)
02-24-2020, 05:13 PM
Post: #2
 tom234 Member Posts: 72 Joined: Aug 2016
RE: Distance, Speed, Time Calculator Using Units
Ty nice programming learned a lot.
02-25-2020, 05:37 PM
Post: #3
 Gene222 Member Posts: 105 Joined: Feb 2015
RE: Distance, Speed, Time Calculator Using Units
The use of the term "unit tags" in the above programs is wrong. When saying "add unit tags to the variables", what is really being done is the real variables are being converted to unit variables. Unit variables are just a TYPE of an object, such as real, integer, string, complex, ...
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)