From 4177802aac8b3ce3fcb42d1511c21fdf97d25f67 Mon Sep 17 00:00:00 2001 From: Caleb Fontenot Date: Fri, 1 Mar 2024 09:38:35 -0600 Subject: [PATCH] Update MP1 --- .gitignore | 2 + Assignments/MP1_CalebFontenot/.dep.inc | 5 +++ Assignments/MP1_CalebFontenot/main.cpp | 43 +++++++++++++++---- .../nbproject/private/configurations.xml | 5 +++ .../nbproject/private/private.xml | 6 +++ 5 files changed, 52 insertions(+), 9 deletions(-) create mode 100644 Assignments/MP1_CalebFontenot/.dep.inc diff --git a/.gitignore b/.gitignore index d4acd7c..48b82cb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ /Assignments/lab2_CalebFontenot/build/ /Assignments/lab2_CalebFontenot/dist/ +/Assignments/MP1_CalebFontenot/build/ +/Assignments/MP1_CalebFontenot/dist/ diff --git a/Assignments/MP1_CalebFontenot/.dep.inc b/Assignments/MP1_CalebFontenot/.dep.inc new file mode 100644 index 0000000..38ba445 --- /dev/null +++ b/Assignments/MP1_CalebFontenot/.dep.inc @@ -0,0 +1,5 @@ +# This code depends on make tool being used +DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES} ${TESTOBJECTFILES})) +ifneq (${DEPFILES},) +include ${DEPFILES} +endif diff --git a/Assignments/MP1_CalebFontenot/main.cpp b/Assignments/MP1_CalebFontenot/main.cpp index a4e2289..e7a28ee 100644 --- a/Assignments/MP1_CalebFontenot/main.cpp +++ b/Assignments/MP1_CalebFontenot/main.cpp @@ -9,8 +9,11 @@ * * Created on February 26, 2024, 11:30 AM */ - +#include #include +#include +#include +#include using namespace std; @@ -18,16 +21,38 @@ using namespace std; * */ -/** - * Write a program that asks for five test scores. - * The program should calculate theaverage - * @param argc - * @param argv - * @return - */ +int milesPerGallon(int gallons, int milesDriven) { + return milesDriven / gallons; +} + +std::tuple maleFemalePercentages(int maleStudents, int femaleStudents) { + int totalStudents = maleStudents + femaleStudents; + double malePercentage = (double) maleStudents / totalStudents; + double femalePercentage = (double) femaleStudents / totalStudents; + return {malePercentage, femalePercentage}; +} + +double celciusToFahrenheit(double celcius) { + return 9.0 / 5.0 * celcius + 32.0; +} + +double monthlySalesTax(int month, int year, double total) { + +} int main(int argc, char** argv) { - + cout << "The car that drove 375 miles and burned 15 gallons of gasoline consumed the fuel at a rate of " << milesPerGallon(15, 375) << " MPG.\n"; + int maleStudents, femaleStudents = 0; + //double malePercentage, femalePercentage = 0.0; + cout << "Enter the number of male students, followed by the number of female students: "; + cin >> maleStudents >> femaleStudents; + auto [malePercentage, femalePercentage] = maleFemalePercentages(maleStudents, femaleStudents); + cout << "The ratio of male to female students is " << setprecision(2) << (malePercentage * 10) << "/" << setprecision(2) <<(femalePercentage * 10) << endl; + cout << "0C is " << std::to_string(celciusToFahrenheit(0)) << "F." << endl; + cout << "100C is " << std::to_string(celciusToFahrenheit(100)) << "F." << endl; + cout << "23.8889C is " << std::to_string(celciusToFahrenheit(23.8889)) << "F." << endl; + + return 0; } diff --git a/Assignments/MP1_CalebFontenot/nbproject/private/configurations.xml b/Assignments/MP1_CalebFontenot/nbproject/private/configurations.xml index 30b54f8..51f948c 100644 --- a/Assignments/MP1_CalebFontenot/nbproject/private/configurations.xml +++ b/Assignments/MP1_CalebFontenot/nbproject/private/configurations.xml @@ -24,11 +24,16 @@ + "${OUTPUT_PATH}" | lolcat + "${OUTPUT_PATH}" | /usr/bin/lolcat + "${OUTPUT_PATH}" | /usr/bin/lolcat -f + "${OUTPUT_PATH}" | /usr/bin/lolcat -F "${OUTPUT_PATH}" "${OUTPUT_PATH}" true + 2 0 0 diff --git a/Assignments/MP1_CalebFontenot/nbproject/private/private.xml b/Assignments/MP1_CalebFontenot/nbproject/private/private.xml index 63a27a8..3480948 100644 --- a/Assignments/MP1_CalebFontenot/nbproject/private/private.xml +++ b/Assignments/MP1_CalebFontenot/nbproject/private/private.xml @@ -4,4 +4,10 @@ 1 0 + + + + file:/home/caleb/ASDV-Cpp/Assignments/MP1_CalebFontenot/main.cpp + +