A classwork/classwork13/.gitignore => classwork/classwork13/.gitignore +1 -0
@@ 0,0 1,1 @@
+/classwork13
A classwork/classwork13/Makefile => classwork/classwork13/Makefile +17 -0
@@ 0,0 1,17 @@
+.PHONY: all clean
+
+PROG = classwork13
+SOURCES = $(wildcard *.cpp)
+OBJ = $(SOURCES:%.cpp=%.o)
+
+all: $(PROG)
+
+$(PROG): ${OBJ}
+ g++ -o $@ $^ -Wall
+
+%.o: %.c
+ g++ -c -o $@ -Wall $^
+
+clean:
+ rm -f $(OBJ)
+ rm -f $(PROG)
A classwork/classwork13/classwork13.cpp => classwork/classwork13/classwork13.cpp +34 -0
@@ 0,0 1,34 @@
+#include <iostream>
+
+using namespace std;
+
+/*
+ * William Culhane
+ * Classwork 13, CSCI 112
+ * Thu Jun 3 10:11:13 AM MDT 2021
+ */
+
+#define REIMBURSEMENT_RATE 0.35
+
+int main(void) {
+ cout << "MILEAGE REIMBURSEMENT CALCULATOR\n";
+
+ double miles_initial, miles_final;
+
+ // Read user data
+ cout << "Enter beginning odometer reading=> ";
+ cin >> miles_initial;
+
+ cout << "Enter ending odometer reading=> ";
+ cin >> miles_final;
+
+ // Perform calculations
+ double distance = miles_final - miles_initial;
+ double reimbursement = distance * REIMBURSEMENT_RATE;
+
+ // Print output
+ cout << "You traveled " << distance << " miles. At $" << REIMBURSEMENT_RATE
+ << " per mile, your reimbursement is $" << reimbursement << ".\n";
+
+ return (0);
+}