Skip to content

Commit 8ec1da0

Browse files
committed
Simplifed conversion (lb/kg) to only use the singular
1 parent 1a5db95 commit 8ec1da0

File tree

7 files changed

+22
-26
lines changed

7 files changed

+22
-26
lines changed

mdbook/src/Chapters/Conversions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ if `frac 5` would have been entered (which means 1/5 is maximum granularity), yo
2828
| ft2in | Converts the value in `line1` from feet to inches |
2929
| deg2rad | Convert `line1` from degrees into [radians](https://en.wikipedia.org/wiki/Radian) |
3030
| rad2deg | Convert `line1` from radians into degrees |
31-
| gram2oz<br>grams2oz | Convert `line1` from grams into ounces using the constant of 0.035274 ounces / gram |
32-
| oz2gram<br>oz2grams | Convert `line1` from ounces into grams using the constant of 28.349523125 grams / ounce |
33-
| kg2lbs<br>kgs2lbs | convert `line1` from kilograms to US pounds using the constant of 2.2046226218 lbs/kg |
34-
| lbs2kg<br>lbs2kgs | convert `line1` from US pounds using the constant of 0.45359237 kg/lbs |
31+
| gram2oz | Convert `line1` from grams into ounces using the constant of 0.035274 ounces / gram |
32+
| oz2gram | Convert `line1` from ounces into grams using the constant of 28.349523125 grams / ounce |
33+
| kg2lb | convert `line1` from kilograms to US pounds using the constant of 2.2046226218 lbs/kg |
34+
| lb2kg | convert `line1` from US pounds using the constant of 0.45359237 kg/lbs |

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<groupId>org.fross</groupId>
55
<artifactId>rpncalc</artifactId>
6-
<version>5.3.1</version>
6+
<version>5.3.2</version>
77
<packaging>jar</packaging>
88

99
<name>rpncalc</name>

snap/snapcraft.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: rpncalc
2-
version: '5.3.1'
2+
version: '5.3.2'
33
summary: The command line Reverse Polish Notation (RPN) calculator
44
description: |
55
RPNCalc is an easy to use command line based Reverse Polish

src/main/java/org/fross/rpncalc/CommandParser.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -252,26 +252,22 @@ public static void Parse(StackObj calcStack, StackObj calcStack2, String cmdInpu
252252

253253
// Convert grams to ounces
254254
case "gram2oz":
255-
case "grams2oz":
256255
StackConversions.cmdGram2Oz(calcStack);
257256
break;
258257

259258
// Convert ounces to grams
260259
case "oz2gram":
261-
case "oz2grams":
262260
StackConversions.cmdOz2Gram(calcStack);
263261
break;
264262

265263
// Convert Kilograms to US Pounds
266-
case "kg2lbs":
267-
case "kgs2lbs":
268-
StackConversions.cmdKg2Lbs(calcStack);
264+
case "kg2lb":
265+
StackConversions.cmdKg2Lb(calcStack);
269266
break;
270267

271268
// Convert US Pounds to Kilograms
272-
case "lbs2kg":
273-
case "lbs2kgs":
274-
StackConversions.cmdLbs2Kg(calcStack);
269+
case "lb2kg":
270+
StackConversions.cmdLb2Kg(calcStack);
275271
break;
276272

277273
/*------------------------------------------------------------------------------

src/main/java/org/fross/rpncalc/Help.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ public static void Display() {
108108
Output.printColorln(Ansi.Color.WHITE, " ft2in Convert line1 from feet to inches");
109109
Output.printColorln(Ansi.Color.WHITE, " gram2oz Convert line1 from grams to US ounces");
110110
Output.printColorln(Ansi.Color.WHITE, " oz2gram Convert line1 from US ounces to grams");
111-
Output.printColorln(Ansi.Color.WHITE, " kg2lbs Convert line1 from kilograms to US pounds");
112-
Output.printColorln(Ansi.Color.WHITE, " lbs2kg Convert line1 from US pounds to kilograms");
111+
Output.printColorln(Ansi.Color.WHITE, " kg2lb Convert line1 from kilograms to US pounds");
112+
Output.printColorln(Ansi.Color.WHITE, " lb2kg Convert line1 from US pounds to kilograms");
113113

114114
Output.printColorln(Ansi.Color.YELLOW, "\nTrigonometry Functions:");
115115
Output.printColorln(Ansi.Color.WHITE, " sin|cos|tan [rad] Trig Functions: Angle is in degrees unless rad is provided");

src/main/java/org/fross/rpncalc/StackConversions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ public static void cmdOz2Gram(StackObj calcStack) {
320320
*
321321
* @param calcStack Primary Stack
322322
*/
323-
public static void cmdKg2Lbs(StackObj calcStack) {
323+
public static void cmdKg2Lb(StackObj calcStack) {
324324
// Ensure we have something on the stack
325325
if (calcStack.isEmpty()) {
326326
Output.printColorln(Ansi.Color.RED, "ERROR: There are no items on the stack.");
@@ -340,7 +340,7 @@ public static void cmdKg2Lbs(StackObj calcStack) {
340340
*
341341
* @param calcStack Primary Stack
342342
*/
343-
public static void cmdLbs2Kg(StackObj calcStack) {
343+
public static void cmdLb2Kg(StackObj calcStack) {
344344
// Ensure we have something on the stack
345345
if (calcStack.isEmpty()) {
346346
Output.printColorln(Ansi.Color.RED, "ERROR: There are no items on the stack.");

src/test/java/org/fross/rpncalc/StackConversionsTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -455,21 +455,21 @@ void testOz2Gram() {
455455
* Test Kilograms to US pounds conversion
456456
*/
457457
@Test
458-
void testKg2Lbs() {
458+
void testKg2Lb() {
459459
StackObj stk = new StackObj();
460460

461461
stk.push(123.321);
462-
StackConversions.cmdKg2Lbs(stk);
462+
StackConversions.cmdKg2Lb(stk);
463463
StackCommands.cmdRound(stk, "5");
464464
assertEquals(271.87627, stk.pop().doubleValue());
465465

466466
stk.push(-0.369);
467-
StackConversions.cmdKg2Lbs(stk);
467+
StackConversions.cmdKg2Lb(stk);
468468
StackCommands.cmdRound(stk, "5");
469469
assertEquals(-0.81351, stk.pop().doubleValue());
470470

471471
stk.push(4.321e18);
472-
StackConversions.cmdKg2Lbs(stk);
472+
StackConversions.cmdKg2Lb(stk);
473473
StackCommands.cmdRound(stk, "2");
474474
assertEquals("9526174348797800000.00", stk.pop().toEngineeringString());
475475

@@ -479,21 +479,21 @@ void testKg2Lbs() {
479479
* Test US Pounds to Kilograms conversion
480480
*/
481481
@Test
482-
void testLbs2Kg() {
482+
void testLb2Kg() {
483483
StackObj stk = new StackObj();
484484

485485
stk.push(456.654);
486-
StackConversions.cmdLbs2Kg(stk);
486+
StackConversions.cmdLb2Kg(stk);
487487
StackCommands.cmdRound(stk, "5");
488488
assertEquals(207.13477, stk.pop().doubleValue());
489489

490490
stk.push(-0.987654);
491-
StackConversions.cmdLbs2Kg(stk);
491+
StackConversions.cmdLb2Kg(stk);
492492
StackCommands.cmdRound(stk, "5");
493493
assertEquals(-0.44799, stk.pop().doubleValue());
494494

495495
stk.push(4.321e18);
496-
StackConversions.cmdLbs2Kg(stk);
496+
StackConversions.cmdLb2Kg(stk);
497497
StackCommands.cmdRound(stk, "2");
498498
assertEquals("1959972630770000000.00", stk.pop().toEngineeringString());
499499
}

0 commit comments

Comments
 (0)