We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 274ca13 commit 910ecceCopy full SHA for 910ecce
src/financial/mod.rs
@@ -0,0 +1,3 @@
1
+mod price_plus_tax;
2
+
3
+pub use price_plus_tax::price_plus_tax;
src/financial/price_plus_tax.rs
@@ -0,0 +1,16 @@
+pub fn price_plus_tax(price: f64, tax_rate: f64) -> f64{
+ price * (1 as f64 + tax_rate)
+}
4
5
6
7
+#[cfg(test)]
8
+mod tests {
9
+ use super::*;
10
11
+ #[test]
12
+ fn test_price_plus_tax() {
13
+ assert_eq!(131.775,price_plus_tax(125.50, 0.05));
14
+ assert_eq!( 125.0,price_plus_tax(100.0, 0.25));
15
+ }
16
src/lib.rs
@@ -19,6 +19,7 @@ pub mod number_theory;
19
pub mod searching;
20
pub mod sorting;
21
pub mod string;
22
+pub mod financial;
23
24
#[cfg(test)]
25
mod tests {
0 commit comments