Questions tagged [unit-conversion]
Code whose primary purpose is to convert quantities from one system of measurement to another
105
questions
4
votes
2
answers
8k
views
Convert a string in time format to minutes
I am new to C#. I just created a method where I can convert a string with the format HH:MM AM/PM to minutes. I was wondering if there is a better or more effective way to achieve the same result.
<...
2
votes
2
answers
152
views
Pounds-to-tons converter
Finished my first lone project and I'm wondering if the execution is passable. This is a basic lbs to tons converter. The customer drives on the scale loaded, then dumps the load and returns unloaded ...
3
votes
1
answer
121
views
Enhancing a Conversion calculator
Could I please have some ideas how to improve this conversion calculator I have made. I am currently not looking to add any more quantities, but rather trying to enhance the usability and add some ...
5
votes
1
answer
263
views
Pretty print uptime given seconds and omit unnecessary strings
Given an integer number of seconds, return a string which represents in human readable format the number of days/hours/minutes/seconds that are equivalent.
...
4
votes
2
answers
121
views
Function to convert strings from hmmss, mmss, ss format to milliseconds
Here's the current logic to convert strings in the format hh:mm:ss, mm:ss or ss to ...
14
votes
5
answers
1k
views
Struct for angles
I would like to ask about the code below:
...
7
votes
2
answers
8k
views
Convert geodetic coordinates to geocentric (cartesian)
I'd like to retain as much float precision as possible without having to resort to specialized libraries so I need this code to work with only standard modules.
I'm doing this in QGIS where ...
4
votes
1
answer
447
views
Simple unit converter and shipment builder
My first python program top to bottom used for work.
First it converts units from imperial to metric and vice versa, then adds the dimensions to a shipment and prints the shipment. When you do a new ...
8
votes
3
answers
3k
views
Temperature converter using "switch" statement
I wrote a program to convert temperature into different units, where the users have to put a space between temperature and unit:
23 f, 34 c, 45 k
...
8
votes
1
answer
4k
views
Python beginner code for a currrency converter
I am also pretty new to Python so I want to show my code for a very small currency converter with an Tkinter GUI.
The code does what I want, but now I want to optimize it and find new "next level" ...
14
votes
5
answers
5k
views
Temperature unit conversion (C,F,K) in C++ - follow-up
Link to my first question:
Converting Celsius and Fahrenheit in C++
I've improved my code, following @Jamal's recommendations. I hope I did everything right. The only thing I didn't get was putting ...
6
votes
1
answer
947
views
Converting Celsius and Fahrenheit in C++
I've made my first little program written in C++ and was wondering if anyone could evaluate it and suggest some improvements. No copy paste. I was wondering if I can do something with my little ...
3
votes
1
answer
966
views
Temperature converter with JavaScript
This is one of my first simple javascript projects. Feedback is appreciated! Basically, everytime the select option is changed, the result is shown.
...
2
votes
0
answers
645
views
Binary, octal, decimal, and hexadecimal conversion in Elisp
Every once in a while I need to convert numbers between bases. As far as I'm aware there are no existing commands that let you do this in Emacs, so I added some.
These functions convert numbers at ...
2
votes
2
answers
1k
views
Temperature conversion in JavaScript
I've made a simple console application using JavaScript, NodeJS and yargs.
index.js
This is the startup file.
...
1
vote
1
answer
64
views
Bash time converter
This is a simple script to convert a given unit of time to other units of time. I wrote this mainly to practice writing scripts that incorporate positional parameters. It actually turned out better ...
4
votes
2
answers
418
views
French Republican date conversion
This program converts a date given from the French Republican Calendar to the corresponding date in our standard Gregorian Calendar. I'm looking for some improvements that I should start making in my ...
2
votes
0
answers
50
views
Module for converting between three currencies
I am creating a simple currency converter, which accepts only 3 currencies. Everything is working fine, just my code doesn't look so good.
I tried to wrap it revealing module pattern, and still ...
4
votes
1
answer
93
views
Converting between different units of temperature
The task is to convert a temperature in a list of Fahrenheit, Celsius, or Kelvin to the two other temperatures in the list.
Here is my code:
...
0
votes
2
answers
165
views
Age converter for some planets
I was wondering if it is better to use:
...
1
vote
0
answers
273
views
Racket - temperature value converter
I'm giving myself programming challenges in various languages so that I can become a better problem solver i.e. focusing on problem abstraction and algorithm design, using various programming ...
4
votes
2
answers
1k
views
Temperature value converter
I'm trying to improve my programming skills (not just using one language). I don't have a group of other programmers to bounce ideas off other than on the web - so please forgive me if I have posted ...
6
votes
3
answers
1k
views
Animal Age Calculator
Could someone suggest ways to simplify this code, or any other tips? All help is much appreciated. Moreover, should I comment code above or below the line of code (I have to comment as this is a ...
2
votes
2
answers
2k
views
Unit conversion application
I have a form with listboxes used for unit conversions. I'm using the UnitsNet package.
Here are my questions:
Is this the proper approach?
If any changes must be made to this code, what are they?
<...
5
votes
1
answer
7k
views
Currency Converter in Python 3
Beginner Python developer here.
I was tinkering around with Python and decided to build a currency converter. It takes in input from the user and prints out the converted currency values. The fixer.io ...
12
votes
4
answers
4k
views
Temperature conversion code
I am currently creating a program that can convert different units of measurement for temperature. It includes conversions for Celsius, Fahrenheit, kelvin and gas mark. Can someone tell me how I could ...
11
votes
3
answers
162
views
Mass and length calculator using Perl 6 custom operator
I am studying chemistry in the university, and then I try to write all the things in the textbook with Perl6 or Perl, like balancing the chemical formula or other process!
Then I encountered the ...
7
votes
4
answers
7k
views
Converting between miles, meters, inches, yards and feet
I am trying to use a class to convert between miles, meters, inches, yards and feet. My instructor told me that
I have way too many functions
My return statements are not storing any values and
My ...
9
votes
8
answers
4k
views
Temperature conversion application
I'm two months in a programming course and our instructor told us we should think about building real-world applications as to gain valuable experience. I got the idea of doing a simple temperature ...
5
votes
2
answers
696
views
Celsius and Fahrenheit Conversion
This is a school project submitted last year, and I've been looking over it and trying to figure out what I could improve on. I know I used celsiusInput and ...
4
votes
2
answers
2k
views
Parsing and converting DMS Coordinates from String to Double
I have some coordinates looking like
N47° 15' 36.75",E011° 20' 38.28",+001906.00
and I've created a class to parse and convert them to Double:
...
4
votes
3
answers
4k
views
Swing Temperature Converter
I made a simple temperature converter to serve as an introduction to swing. I used Eclipse WindowBuilder and did not attempt to make the components more modular. I'm curious as to how you guys would ...
5
votes
1
answer
196
views
Temperature converter app
I'm learning Ruby and as an exercise I decided to build this little temperature converter app (C to F, F to C, F to K, etc). Looking back at it, it's pretty much just a bunch of boilerplate code. Any ...
4
votes
1
answer
133
views
Convert and print Celsius to Fahrenheit from certain range of values
I just started learning C, and got to the "for loops"—where an exercise is given to convert Celsius to Fahrenheit ( from -50 to 1000 with a step of 20 ), and print the values. I decided to play with ...
2
votes
2
answers
2k
views
Byte Array to Hexadecimal String Conversion
Another journey down the difficult path! I'd like to know if there's anything I haven't accounted for, if this can be significantly improved, etc.
(Just as a side-note, I know that some of the ...
2
votes
1
answer
88
views
Fahrenheit / Celsius temperature converter - follow-up
This is an updated version of the script Fahrenheit / Celsius temperature converter. I have changed the script to be non-interactive, using positional parameters instead of asking for user input once ...
1
vote
1
answer
2k
views
Temperature converter program
Can anyone suggest any improvements? I already applied here the suggestions that was made for my first program (Guess the Number) that I posted.
...
6
votes
3
answers
3k
views
Fahrenheit / Celsius temperature converter
This is a simple bash script (hopefully with a little style as well) for converting temperatures from Fahrenheit to Celsius and vice versa.
...
4
votes
3
answers
278
views
Convert length of time to appropriate unit
I have a time, in seconds, which has the possibility to be very large. I wish to convert said time into the "appropriate" rounded, readable format.
I already have code which achieves this, however it'...
6
votes
4
answers
276
views
Simple Temperature Converter 2 in C
I finally got around to redoing my Temperature conversion program. I incorporated many elements of everyone's comments, and am uploading the finished program. Any new, or problems that I missed? Maybe ...
10
votes
9
answers
2k
views
Simple temperature converter in C
I have just begun to learn the C language and wanted to start off small with a temperature conversion calculator. The program works, and I'm looking for feedback on do's and don'ts as I am sure there ...
5
votes
1
answer
3k
views
Currency converter built with AngularJS
I am fairly new to AngularJS and I am trying to improve my knowledge of this JavaScript Framework by building small real-world web-apps.
In this case, I have built a currency converter app with ...
2
votes
1
answer
990
views
Simple object oriented design for an Temperature class
Design a temperature class for nurses to store patient temperature and the method of taking the temperature.
How would you handle different units of temperature? Write a function to determine if a ...
0
votes
2
answers
722
views
Temperature scale converter in Java
I am creating this converter.
There are three units that can be converted: kelvin, celcius and fahrenheit.
I used two variables to check which unit is chosen.
It's cek and cek2.
Is there any way I can ...
0
votes
1
answer
127
views
Converting units of volume
I am creating a volume converter. It allows users to enter a value and select the unit to convert from and the one it will be converted into. It uses a ...
6
votes
2
answers
597
views
Android unit converter
I am developing a unit converter application for Android. The application is working correctly, but my problem is with the optimization. Is there a way to somehow optimize the code?
I have different ...
4
votes
2
answers
4k
views
Unit converter application
I am working on an Android unit converter application, but I came to the point where I have to assign the formulas to the calculation method. At the moment I am using a switch-case statement, as it is ...
2
votes
2
answers
8k
views
Converting from Celsius to Fahrenheit and vice versa
My code asks the user for the type of conversion, the degrees and spits the result back. It will prompt the user to ask for the type of conversion again if it's invalid. It will also prompt the user ...
9
votes
5
answers
2k
views
Comparing Old vs. New: Temperature Converter
I made this temperature converter when I first started getting into Python. After a year of regular programming on my own I decide it was time to revisit my old program. Now that I finished my first ...
3
votes
2
answers
189
views
Converting UK drams to ounces and pounds in PHP
I have written this little function to convert UK weight drams (dr) to ounces (oz) and pounds (lbs). As far as my research goes, 1 lbs = 16 oz and 1 oz = 16 dr. I need the function to return an array ...