commit a8f6ecbae655a4b268a4b0dd4c3a7a6a2525b1ee Author: Cody Cook Date: Tue Apr 11 18:40:15 2023 -0700 Initial commit diff --git a/.vs/Project2/v16/.suo b/.vs/Project2/v16/.suo new file mode 100644 index 0000000..e715bb8 Binary files /dev/null and b/.vs/Project2/v16/.suo differ diff --git a/.vs/Project2/v16/Browse.VC.db b/.vs/Project2/v16/Browse.VC.db new file mode 100644 index 0000000..8f8bedb Binary files /dev/null and b/.vs/Project2/v16/Browse.VC.db differ diff --git a/.vs/Project2/v16/Browse.VC.db-shm b/.vs/Project2/v16/Browse.VC.db-shm new file mode 100644 index 0000000..75560a6 Binary files /dev/null and b/.vs/Project2/v16/Browse.VC.db-shm differ diff --git a/.vs/Project2/v16/Browse.VC.db-wal b/.vs/Project2/v16/Browse.VC.db-wal new file mode 100644 index 0000000..e69de29 diff --git a/.vs/Project2/v16/Browse.VC.opendb b/.vs/Project2/v16/Browse.VC.opendb new file mode 100644 index 0000000..c91e38d Binary files /dev/null and b/.vs/Project2/v16/Browse.VC.opendb differ diff --git a/.vs/Project2/v16/ipch/AutoPCH/1842dfee5e106f69/MAIN.ipch b/.vs/Project2/v16/ipch/AutoPCH/1842dfee5e106f69/MAIN.ipch new file mode 100644 index 0000000..ded9cfe Binary files /dev/null and b/.vs/Project2/v16/ipch/AutoPCH/1842dfee5e106f69/MAIN.ipch differ diff --git a/.vs/Project2/v16/ipch/AutoPCH/18a037b8c9933f/MAIN.ipch b/.vs/Project2/v16/ipch/AutoPCH/18a037b8c9933f/MAIN.ipch new file mode 100644 index 0000000..a450e52 Binary files /dev/null and b/.vs/Project2/v16/ipch/AutoPCH/18a037b8c9933f/MAIN.ipch differ diff --git a/.vs/Project2/v16/ipch/AutoPCH/23f53502fc93d721/STYLE.ipch b/.vs/Project2/v16/ipch/AutoPCH/23f53502fc93d721/STYLE.ipch new file mode 100644 index 0000000..e40378a Binary files /dev/null and b/.vs/Project2/v16/ipch/AutoPCH/23f53502fc93d721/STYLE.ipch differ diff --git a/.vs/Project2/v16/ipch/AutoPCH/6b3008700134ada/MAIN.ipch b/.vs/Project2/v16/ipch/AutoPCH/6b3008700134ada/MAIN.ipch new file mode 100644 index 0000000..dc69641 Binary files /dev/null and b/.vs/Project2/v16/ipch/AutoPCH/6b3008700134ada/MAIN.ipch differ diff --git a/.vs/Project2/v16/ipch/AutoPCH/6bffffa0b2bda28e/MENU.ipch b/.vs/Project2/v16/ipch/AutoPCH/6bffffa0b2bda28e/MENU.ipch new file mode 100644 index 0000000..2e0acbd Binary files /dev/null and b/.vs/Project2/v16/ipch/AutoPCH/6bffffa0b2bda28e/MENU.ipch differ diff --git a/.vs/Project2/v16/ipch/AutoPCH/6ea2b7c5feaa02b3/INTEREST.ipch b/.vs/Project2/v16/ipch/AutoPCH/6ea2b7c5feaa02b3/INTEREST.ipch new file mode 100644 index 0000000..5ea1dcb Binary files /dev/null and b/.vs/Project2/v16/ipch/AutoPCH/6ea2b7c5feaa02b3/INTEREST.ipch differ diff --git a/.vs/Project2/v16/ipch/AutoPCH/95054a3829ab678c/MAIN.ipch b/.vs/Project2/v16/ipch/AutoPCH/95054a3829ab678c/MAIN.ipch new file mode 100644 index 0000000..17e1751 Binary files /dev/null and b/.vs/Project2/v16/ipch/AutoPCH/95054a3829ab678c/MAIN.ipch differ diff --git a/.vs/Project2/v16/ipch/AutoPCH/a70ee99902d27790/STYLE.ipch b/.vs/Project2/v16/ipch/AutoPCH/a70ee99902d27790/STYLE.ipch new file mode 100644 index 0000000..0d5503b Binary files /dev/null and b/.vs/Project2/v16/ipch/AutoPCH/a70ee99902d27790/STYLE.ipch differ diff --git a/.vs/Project2/v16/ipch/AutoPCH/e042dfb6efd51573/MENU.ipch b/.vs/Project2/v16/ipch/AutoPCH/e042dfb6efd51573/MENU.ipch new file mode 100644 index 0000000..566508b Binary files /dev/null and b/.vs/Project2/v16/ipch/AutoPCH/e042dfb6efd51573/MENU.ipch differ diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..66e85f9 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,50 @@ +{ + "files.associations": { + "iostream": "cpp", + "iomanip": "cpp", + "atomic": "cpp", + "bit": "cpp", + "cctype": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "compare": "cpp", + "concepts": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "exception": "cpp", + "initializer_list": "cpp", + "ios": "cpp", + "iosfwd": "cpp", + "istream": "cpp", + "iterator": "cpp", + "limits": "cpp", + "memory": "cpp", + "new": "cpp", + "ostream": "cpp", + "stdexcept": "cpp", + "streambuf": "cpp", + "string": "cpp", + "system_error": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "typeinfo": "cpp", + "utility": "cpp", + "xfacet": "cpp", + "xiosbase": "cpp", + "xlocale": "cpp", + "xlocinfo": "cpp", + "xlocmon": "cpp", + "xlocnum": "cpp", + "xloctime": "cpp", + "xmemory": "cpp", + "xstddef": "cpp", + "xstring": "cpp", + "xtr1common": "cpp", + "xutility": "cpp" + } +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..394a2a5 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,29 @@ +{ + "tasks": [ + { + "type": "cppbuild", + "label": "C/C++: clang.exe build active file", + "command": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\Llvm\\x64\\bin\\clang.exe", + "args": [ + "-fcolor-diagnostics", + "-fansi-escape-codes", + "-g", + "${file}", + "-o", + "${fileDirname}\\${fileBasenameNoExtension}.exe" + ], + "options": { + "cwd": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\Llvm\\x64\\bin" + }, + "problemMatcher": [ + "$gcc" + ], + "group": { + "kind": "build", + "isDefault": true + }, + "detail": "Task generated by Debugger." + } + ], + "version": "2.0.0" +} \ No newline at end of file diff --git a/Project2.sln b/Project2.sln new file mode 100644 index 0000000..6869788 --- /dev/null +++ b/Project2.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.33423.256 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Project2", "Project2\Project2.vcxproj", "{DDF996D8-F626-45D4-BB38-220353B476AA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DDF996D8-F626-45D4-BB38-220353B476AA}.Debug|x64.ActiveCfg = Debug|x64 + {DDF996D8-F626-45D4-BB38-220353B476AA}.Debug|x64.Build.0 = Debug|x64 + {DDF996D8-F626-45D4-BB38-220353B476AA}.Debug|x86.ActiveCfg = Release|Win32 + {DDF996D8-F626-45D4-BB38-220353B476AA}.Debug|x86.Build.0 = Release|Win32 + {DDF996D8-F626-45D4-BB38-220353B476AA}.Release|x64.ActiveCfg = Release|x64 + {DDF996D8-F626-45D4-BB38-220353B476AA}.Release|x64.Build.0 = Release|x64 + {DDF996D8-F626-45D4-BB38-220353B476AA}.Release|x86.ActiveCfg = Release|Win32 + {DDF996D8-F626-45D4-BB38-220353B476AA}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {1D296CFC-4C33-4395-84B4-4A74ED69020D} + EndGlobalSection +EndGlobal diff --git a/Project2/Debug/Interest.obj b/Project2/Debug/Interest.obj new file mode 100644 index 0000000..fe671d7 Binary files /dev/null and b/Project2/Debug/Interest.obj differ diff --git a/Project2/Debug/Menu.obj b/Project2/Debug/Menu.obj new file mode 100644 index 0000000..33cae3d Binary files /dev/null and b/Project2/Debug/Menu.obj differ diff --git a/Project2/Debug/Project2.Build.CppClean.log b/Project2/Debug/Project2.Build.CppClean.log new file mode 100644 index 0000000..fa8768e --- /dev/null +++ b/Project2/Debug/Project2.Build.CppClean.log @@ -0,0 +1,18 @@ +c:\users\cody\onedrive - snhu\cs-210\project2\project2\debug\vc142.pdb +c:\users\cody\onedrive - snhu\cs-210\project2\project2\debug\vc142.idb +c:\users\cody\onedrive - snhu\cs-210\project2\project2\debug\menu.obj +c:\users\cody\onedrive - snhu\cs-210\project2\project2\debug\main.obj +c:\users\cody\onedrive - snhu\cs-210\project2\project2\debug\interest.obj +c:\users\cody\onedrive - snhu\cs-210\project2\debug\project2.exe +c:\users\cody\onedrive - snhu\cs-210\project2\project2\debug\project2.ilk +c:\users\cody\onedrive - snhu\cs-210\project2\debug\project2.pdb +c:\users\cody\onedrive - snhu\cs-210\project2\project2\debug\project2.res +c:\users\cody\onedrive - snhu\cs-210\project2\project2\debug\project2.tlog\cl.command.1.tlog +c:\users\cody\onedrive - snhu\cs-210\project2\project2\debug\project2.tlog\cl.read.1.tlog +c:\users\cody\onedrive - snhu\cs-210\project2\project2\debug\project2.tlog\cl.write.1.tlog +c:\users\cody\onedrive - snhu\cs-210\project2\project2\debug\project2.tlog\link.command.1.tlog +c:\users\cody\onedrive - snhu\cs-210\project2\project2\debug\project2.tlog\link.read.1.tlog +c:\users\cody\onedrive - snhu\cs-210\project2\project2\debug\project2.tlog\link.write.1.tlog +c:\users\cody\onedrive - snhu\cs-210\project2\project2\debug\project2.tlog\rc.command.1.tlog +c:\users\cody\onedrive - snhu\cs-210\project2\project2\debug\project2.tlog\rc.read.1.tlog +c:\users\cody\onedrive - snhu\cs-210\project2\project2\debug\project2.tlog\rc.write.1.tlog diff --git a/Project2/Debug/Project2.exe.recipe b/Project2/Debug/Project2.exe.recipe new file mode 100644 index 0000000..2e01e9e --- /dev/null +++ b/Project2/Debug/Project2.exe.recipe @@ -0,0 +1,11 @@ + + + + + C:\Users\cody\OneDrive - SNHU\CS-210\Project2\Debug\Project2.exe + + + + + + \ No newline at end of file diff --git a/Project2/Debug/Project2.ilk b/Project2/Debug/Project2.ilk new file mode 100644 index 0000000..82bf174 Binary files /dev/null and b/Project2/Debug/Project2.ilk differ diff --git a/Project2/Debug/Project2.log b/Project2/Debug/Project2.log new file mode 100644 index 0000000..2463744 --- /dev/null +++ b/Project2/Debug/Project2.log @@ -0,0 +1,5 @@ + Interest.cpp + main.cpp + Menu.cpp + Generating Code... + Project2.vcxproj -> C:\Users\cody\OneDrive - SNHU\CS-210\Project2\Debug\Project2.exe diff --git a/Project2/Debug/Project2.res b/Project2/Debug/Project2.res new file mode 100644 index 0000000..b317d4b Binary files /dev/null and b/Project2/Debug/Project2.res differ diff --git a/Project2/Debug/Project2.tlog/CL.command.1.tlog b/Project2/Debug/Project2.tlog/CL.command.1.tlog new file mode 100644 index 0000000..6a9126a Binary files /dev/null and b/Project2/Debug/Project2.tlog/CL.command.1.tlog differ diff --git a/Project2/Debug/Project2.tlog/CL.read.1.tlog b/Project2/Debug/Project2.tlog/CL.read.1.tlog new file mode 100644 index 0000000..c5a599b Binary files /dev/null and b/Project2/Debug/Project2.tlog/CL.read.1.tlog differ diff --git a/Project2/Debug/Project2.tlog/CL.write.1.tlog b/Project2/Debug/Project2.tlog/CL.write.1.tlog new file mode 100644 index 0000000..778ffb7 Binary files /dev/null and b/Project2/Debug/Project2.tlog/CL.write.1.tlog differ diff --git a/Project2/Debug/Project2.tlog/Project2.lastbuildstate b/Project2/Debug/Project2.tlog/Project2.lastbuildstate new file mode 100644 index 0000000..f451097 --- /dev/null +++ b/Project2/Debug/Project2.tlog/Project2.lastbuildstate @@ -0,0 +1,2 @@ +PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.29.30133:TargetPlatformVersion=10.0.22621.0: +Debug|Win32|C:\Users\cody\OneDrive - SNHU\CS-210\Project2\| diff --git a/Project2/Debug/Project2.tlog/link.command.1.tlog b/Project2/Debug/Project2.tlog/link.command.1.tlog new file mode 100644 index 0000000..b8ffeab Binary files /dev/null and b/Project2/Debug/Project2.tlog/link.command.1.tlog differ diff --git a/Project2/Debug/Project2.tlog/link.read.1.tlog b/Project2/Debug/Project2.tlog/link.read.1.tlog new file mode 100644 index 0000000..de1447e Binary files /dev/null and b/Project2/Debug/Project2.tlog/link.read.1.tlog differ diff --git a/Project2/Debug/Project2.tlog/link.write.1.tlog b/Project2/Debug/Project2.tlog/link.write.1.tlog new file mode 100644 index 0000000..bd7b096 Binary files /dev/null and b/Project2/Debug/Project2.tlog/link.write.1.tlog differ diff --git a/Project2/Debug/Project2.tlog/rc.command.1.tlog b/Project2/Debug/Project2.tlog/rc.command.1.tlog new file mode 100644 index 0000000..fcffd33 Binary files /dev/null and b/Project2/Debug/Project2.tlog/rc.command.1.tlog differ diff --git a/Project2/Debug/Project2.tlog/rc.read.1.tlog b/Project2/Debug/Project2.tlog/rc.read.1.tlog new file mode 100644 index 0000000..2391e13 Binary files /dev/null and b/Project2/Debug/Project2.tlog/rc.read.1.tlog differ diff --git a/Project2/Debug/Project2.tlog/rc.write.1.tlog b/Project2/Debug/Project2.tlog/rc.write.1.tlog new file mode 100644 index 0000000..26eebbc Binary files /dev/null and b/Project2/Debug/Project2.tlog/rc.write.1.tlog differ diff --git a/Project2/Debug/Project2.vcxproj.FileListAbsolute.txt b/Project2/Debug/Project2.vcxproj.FileListAbsolute.txt new file mode 100644 index 0000000..e69de29 diff --git a/Project2/Debug/main.obj b/Project2/Debug/main.obj new file mode 100644 index 0000000..5c07a52 Binary files /dev/null and b/Project2/Debug/main.obj differ diff --git a/Project2/Debug/vc142.idb b/Project2/Debug/vc142.idb new file mode 100644 index 0000000..7710d9e Binary files /dev/null and b/Project2/Debug/vc142.idb differ diff --git a/Project2/Debug/vc142.pdb b/Project2/Debug/vc142.pdb new file mode 100644 index 0000000..b1462e7 Binary files /dev/null and b/Project2/Debug/vc142.pdb differ diff --git a/Project2/Interest.cpp b/Project2/Interest.cpp new file mode 100644 index 0000000..a2dee54 --- /dev/null +++ b/Project2/Interest.cpp @@ -0,0 +1,129 @@ +/* +* Cody Cook +* Project 2 +* SNHU +* 2023/04/02 +*/ +#include +#include +#include +#include "Interest.h" +#include "Menu.h" + +// Overloaded constructor +Interest::Interest() +{ + m_initial = 0; + m_rate = 0; + m_years = 0; + m_monthly = 0; +} + +// Overloaded constructor +Interest::Interest(double initial, double monthly, double rate, unsigned int years) +{ + m_initial = initial; + m_rate = rate; + m_years = years; + m_monthly = monthly; +} + +// Setters + +// Set the initial investment amount +void Interest::setInitial(double t_initial) +{ + m_initial = t_initial; +} + +// Set the interest rate +void Interest::setRate(double t_rate) +{ + m_rate = t_rate; +} + +// Set the number of years +void Interest::setYears(unsigned int t_years) +{ + m_years = t_years; +} + +// Set the monthly deposit amount +void Interest::setMonthly(double t_monthly) +{ + m_monthly = t_monthly; +} + +// Getters + +// Get the initial investment amount +double Interest::getInitial() const +{ + return m_initial; +} + +// Get the interest rate +double Interest::getRate() const +{ + return m_rate; +} + +// Get the number of years +unsigned int Interest::getYears() const +{ + return m_years; +} + +// Get the monthly deposit amount +double Interest::getMonthly() const +{ + return m_monthly; +} + +// calculate the balance; if t_monthlyDeposit is true, add the monthly deposit amount to the balance each month +void Interest::calculateBalance(bool t_monthlyDeposit) +{ + // set variables + double yearEndBalance = m_initial; + double interestEarned = 0; + double interestRatePerMonth = m_rate / 100 / 12; + const std::string HEADERS[] = {"Year", "Year End Balance", "Interest Earned"}; + std::string deposit; + + // set the string depending on mode + if (t_monthlyDeposit) + { + deposit = "with"; + } + else + { + deposit = "without"; + } + + // display headers + surroundText("Results " + deposit + " a monthly deposit", 74, '#', true); + std::cout << HEADERS[0] << "\t\t\t" << HEADERS[1] << "\t\t" << HEADERS[2] << "\t" << '#' << std::endl; + + // for every year + for (unsigned int year = 1; year <= m_years; year++) + { + double yearEndInterestEarned = 0; + + // for every month + for (int month = 1; month <= 12; month++) + { + // find the amount of interest earned, add it to the year end value, then add the interest to the balance + interestEarned = yearEndBalance * interestRatePerMonth; + yearEndInterestEarned += interestEarned; + yearEndBalance += interestEarned; + + // if the mothly deposit is set, add it to the balance + if (t_monthlyDeposit) + { + yearEndBalance += m_monthly; + } + } + // output the details + printDetails(year, yearEndBalance, yearEndInterestEarned); + } +} diff --git a/Project2/Interest.h b/Project2/Interest.h new file mode 100644 index 0000000..7a72664 --- /dev/null +++ b/Project2/Interest.h @@ -0,0 +1,34 @@ +/* +* Cody Cook +* Project 2 +* SNHU +* 2023/04/02 +*/ +#ifndef INTEREST_H +#define INTEREST_H +class Interest +{ +public: + Interest(); + Interest(double t_initial = 0, double t_monthly = 0, double t_rate = 0, unsigned int t_years = 0); + // getters + double getInitial() const; + double getRate() const; + unsigned int getYears() const; + double getMonthly() const; + // setters + void setInitial(double t_initial); + void setRate(double t_rate); + void setYears(unsigned int t_years); + void setMonthly(double t_monthly); + // methods + void calculateBalance(bool t_monthlyDeposit); + +private: + double m_initial; + double m_rate; + unsigned int m_years; + double m_monthly; +}; + +#endif \ No newline at end of file diff --git a/Project2/Interest.pdb b/Project2/Interest.pdb new file mode 100644 index 0000000..65d8090 Binary files /dev/null and b/Project2/Interest.pdb differ diff --git a/Project2/Menu.cpp b/Project2/Menu.cpp new file mode 100644 index 0000000..c5f18c7 --- /dev/null +++ b/Project2/Menu.cpp @@ -0,0 +1,156 @@ +/* +* Cody Cook +* Project 2 +* SNHU +* 2023/04/02 +*/ +#include +#include +#include +#include "Interest.h" + +// surround text with a character, add buffer when needed +void surroundText(std::string t_text, int t_lineLength, char t_dataInputLine, bool t_bothTopBottom) +{ + if (t_text.length() % 2 == t_lineLength % 2) + { + t_text = " " + t_text + " "; + } + else + { + t_text = " " + t_text + " "; + } + if (t_bothTopBottom) + { + std::cout << std::string(t_lineLength, t_dataInputLine) << std::endl; + } + std::cout << std::string((t_lineLength - t_text.length()) / 2, t_dataInputLine) << t_text << std::string((t_lineLength - t_text.length()) / 2, t_dataInputLine) << std::endl; + if (t_bothTopBottom) + { + std::cout << std::string(t_lineLength, t_dataInputLine) << std::endl; + } +} + +// add a separator line +void separator(int t_lineLength, char t_dataInputLine, bool t_emptyLine = true) +{ + if (t_emptyLine) + { + std::cout << t_dataInputLine << std::string(t_lineLength - 2, ' ') << t_dataInputLine << std::endl; + } + else + { + std::cout << std::string(t_lineLength, t_dataInputLine) << std::endl; + } +} + +// print details out to screen +void printDetails(unsigned int t_year, double t_yearEndBalance, double t_interestEarned) +{ + std::string tabs = "\t\t\t $"; + std::cout << t_year << tabs; + std::cout << std::fixed << std::setprecision(2); + std::cout << t_yearEndBalance << tabs; + std::cout << t_interestEarned << std::endl; +} + +// print out the bank header +void printHeader() { + unsigned int lineLength = 35; + std::string bankName = "Airgead Banking"; + char dataInputLine = '#'; + + // print out the headers + surroundText(bankName, lineLength, dataInputLine, true); + separator(lineLength, dataInputLine, true); +} + +void menu() { + // set some default variables + int menuOption = 0; + double initialInvestment = 0; + double monthlyDeposit = 0; + double interestRate = 0; + int numberOfYears = 0; + std::string invalidInput = "Invalid input. Please try again:"; + + // until the menu is -1, loop through the menu + while (menuOption != -1) + { + unsigned int lineLength = 35; + const std::string DATA_INPUT = "Data Input"; + char dataInputLine = '#'; + + // output the step + surroundText(DATA_INPUT, lineLength, dataInputLine, false); + + // start collecting user input + std::cout << "Initial Investment:\t$"; + while (!(std::cin >> initialInvestment)) + { + std::cout << invalidInput; + std::cin.clear(); + std::cin.ignore(std::numeric_limits::max(), '\n'); + } + std::cout << "Monthly Deposit:\t$"; + while (!(std::cin >> monthlyDeposit)) + { + std::cout << invalidInput; + std::cin.clear(); + std::cin.ignore(std::numeric_limits::max(), '\n'); + } + std::cout << "Interest Rate:\t\t%"; + while (!(std::cin >> interestRate)) + { + std::cout << invalidInput; + std::cin.clear(); + std::cin.ignore(std::numeric_limits::max(), '\n'); + } + std::cout << "Number of Years:\t "; + while (!(std::cin >> numberOfYears)) + { + std::cout << invalidInput; + std::cin.clear(); + std::cin.ignore(std::numeric_limits::max(), '\n'); + } + + // setup myInterest + auto myInterest = Interest(initialInvestment, monthlyDeposit, interestRate, numberOfYears); + + system("pause"); + system("cls"); + + // show the balances without the monthly payment + myInterest.calculateBalance(false); + + // show the balances with the monthly payment + myInterest.calculateBalance(true); + system("pause"); + + // find out what user wants to do now + std::cout << std::endl << std::endl << "To enter new values, press 1. To exit, press 2: "; + while (!(std::cin >> menuOption)) + { + // not a valid option + std::cout << invalidInput; + std::cin.clear(); + std::cin.ignore(std::numeric_limits::max(), '\n'); + } + if (menuOption == 1) + { + // clear the screen and start over again + system("cls"); + printHeader(); + } + else if (menuOption == 2) + { + // exit the program + menuOption = -1; + } + else + { + //ask the user to try again with a valid input + std::cout << "Invalid input. Please try again: "; + } + } +} diff --git a/Project2/Menu.h b/Project2/Menu.h new file mode 100644 index 0000000..1725208 --- /dev/null +++ b/Project2/Menu.h @@ -0,0 +1,23 @@ +/* +* Cody Cook +* Project 2 +* SNHU +* 2023/04/02 +*/ +#ifndef MENU_H +#define MENU_H + +#include +#include +#include + +#pragma once + +void surroundText(std::string t_text, int t_lineLength, char t_dataInputLine, bool t_bothTopBottom); +void separator(int t_lineLength, char t_dataInputLine, bool t_emptyLine = true); +void printDetails(unsigned int t_year, double t_yearEndBalance, double t_interestEarned); +void menu(); +void printHeader(); + + +#endif \ No newline at end of file diff --git a/Project2/Project2.aps b/Project2/Project2.aps new file mode 100644 index 0000000..f177259 Binary files /dev/null and b/Project2/Project2.aps differ diff --git a/Project2/Project2.rc b/Project2/Project2.rc new file mode 100644 index 0000000..d22b6c9 --- /dev/null +++ b/Project2/Project2.rc @@ -0,0 +1,100 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource1.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource1.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Cody Cook" + VALUE "FileDescription", "Project 2: Annual Interest Calculator" + VALUE "FileVersion", "1.0.0.1" + VALUE "InternalName", "Project2.exe" + VALUE "LegalCopyright", "Copyright (C) 2023 Cody Cook" + VALUE "OriginalFilename", "Project2.exe" + VALUE "ProductName", "Annual Interest Calculator" + VALUE "ProductVersion", "1.0.0.1" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/Project2/Project2.vcxproj b/Project2/Project2.vcxproj new file mode 100644 index 0000000..13f7233 --- /dev/null +++ b/Project2/Project2.vcxproj @@ -0,0 +1,157 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {ddf996d8-f626-45d4-bb38-220353b476aa} + Project2 + 10.0 + + + + Application + true + v142 + Unicode + + + Application + false + v142 + true + Unicode + + + Application + true + v142 + Unicode + + + Application + false + v142 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + false + + + true + + + false + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Project2/Project2.vcxproj.filters b/Project2/Project2.vcxproj.filters new file mode 100644 index 0000000..7aa1030 --- /dev/null +++ b/Project2/Project2.vcxproj.filters @@ -0,0 +1,44 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Source Files + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/Project2/Project2.vcxproj.user b/Project2/Project2.vcxproj.user new file mode 100644 index 0000000..0f14913 --- /dev/null +++ b/Project2/Project2.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Project2/RCa62888 b/Project2/RCa62888 new file mode 100644 index 0000000..e0270c2 Binary files /dev/null and b/Project2/RCa62888 differ diff --git a/Project2/Release/Project2.Build.CppClean.log b/Project2/Release/Project2.Build.CppClean.log new file mode 100644 index 0000000..4d59555 --- /dev/null +++ b/Project2/Release/Project2.Build.CppClean.log @@ -0,0 +1,18 @@ +c:\users\cody\onedrive - snhu\cs-210\project2\project2\release\vc142.pdb +c:\users\cody\onedrive - snhu\cs-210\project2\project2\release\menu.obj +c:\users\cody\onedrive - snhu\cs-210\project2\project2\release\main.obj +c:\users\cody\onedrive - snhu\cs-210\project2\project2\release\interest.obj +c:\users\cody\onedrive - snhu\cs-210\project2\release\project2.exe +c:\users\cody\onedrive - snhu\cs-210\project2\project2\release\project2.ipdb +c:\users\cody\onedrive - snhu\cs-210\project2\project2\release\project2.iobj +c:\users\cody\onedrive - snhu\cs-210\project2\release\project2.pdb +c:\users\cody\onedrive - snhu\cs-210\project2\project2\release\project2.res +c:\users\cody\onedrive - snhu\cs-210\project2\project2\release\project2.tlog\cl.command.1.tlog +c:\users\cody\onedrive - snhu\cs-210\project2\project2\release\project2.tlog\cl.read.1.tlog +c:\users\cody\onedrive - snhu\cs-210\project2\project2\release\project2.tlog\cl.write.1.tlog +c:\users\cody\onedrive - snhu\cs-210\project2\project2\release\project2.tlog\link.command.1.tlog +c:\users\cody\onedrive - snhu\cs-210\project2\project2\release\project2.tlog\link.read.1.tlog +c:\users\cody\onedrive - snhu\cs-210\project2\project2\release\project2.tlog\link.write.1.tlog +c:\users\cody\onedrive - snhu\cs-210\project2\project2\release\project2.tlog\rc.command.1.tlog +c:\users\cody\onedrive - snhu\cs-210\project2\project2\release\project2.tlog\rc.read.1.tlog +c:\users\cody\onedrive - snhu\cs-210\project2\project2\release\project2.tlog\rc.write.1.tlog diff --git a/Project2/Release/Project2.exe.recipe b/Project2/Release/Project2.exe.recipe new file mode 100644 index 0000000..651a2a2 --- /dev/null +++ b/Project2/Release/Project2.exe.recipe @@ -0,0 +1,11 @@ + + + + + C:\Users\cody\OneDrive - SNHU\CS-210\Project2\Release\Project2.exe + + + + + + \ No newline at end of file diff --git a/Project2/Release/Project2.log b/Project2/Release/Project2.log new file mode 100644 index 0000000..5f28270 --- /dev/null +++ b/Project2/Release/Project2.log @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Project2/Release/Project2.vcxproj.FileListAbsolute.txt b/Project2/Release/Project2.vcxproj.FileListAbsolute.txt new file mode 100644 index 0000000..e69de29 diff --git a/Project2/main.cpp b/Project2/main.cpp new file mode 100644 index 0000000..34fc854 --- /dev/null +++ b/Project2/main.cpp @@ -0,0 +1,22 @@ +/* +* Cody Cook +* Project 2 +* SNHU +* 2023/04/02 +*/ + +#include +#include "Interest.h" +#include "Menu.h" + +int main() +{ + // print the header + printHeader(); + + // go through menu + menu(); + + std::cout << "Thank you." << std::endl << std::endl; + return 0; +} \ No newline at end of file diff --git a/Project2/main.pdb b/Project2/main.pdb new file mode 100644 index 0000000..fed5ae5 Binary files /dev/null and b/Project2/main.pdb differ diff --git a/Project2/resource.h b/Project2/resource.h new file mode 100644 index 0000000..bc8fb52 --- /dev/null +++ b/Project2/resource.h @@ -0,0 +1,14 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Project2.rc + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/Project2/resource1.h b/Project2/resource1.h new file mode 100644 index 0000000..bc8fb52 --- /dev/null +++ b/Project2/resource1.h @@ -0,0 +1,14 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Project2.rc + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/Project2/x64/Debug/Project2.Build.CppClean.log b/Project2/x64/Debug/Project2.Build.CppClean.log new file mode 100644 index 0000000..e69de29 diff --git a/Project2/x64/Debug/Project2.log b/Project2/x64/Debug/Project2.log new file mode 100644 index 0000000..5f28270 --- /dev/null +++ b/Project2/x64/Debug/Project2.log @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Project2/x64/Debug/Project2.vcxproj.FileListAbsolute.txt b/Project2/x64/Debug/Project2.vcxproj.FileListAbsolute.txt new file mode 100644 index 0000000..e69de29 diff --git a/Project2/x64/Release/Project2.Build.CppClean.log b/Project2/x64/Release/Project2.Build.CppClean.log new file mode 100644 index 0000000..e69de29 diff --git a/Project2/x64/Release/Project2.exe.recipe b/Project2/x64/Release/Project2.exe.recipe new file mode 100644 index 0000000..eb89598 --- /dev/null +++ b/Project2/x64/Release/Project2.exe.recipe @@ -0,0 +1,11 @@ + + + + + C:\Users\cody\OneDrive - SNHU\CS-210\Project2\x64\Release\Project2.exe + + + + + + \ No newline at end of file diff --git a/Project2/x64/Release/Project2.log b/Project2/x64/Release/Project2.log new file mode 100644 index 0000000..5f28270 --- /dev/null +++ b/Project2/x64/Release/Project2.log @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Project2/x64/Release/Project2.vcxproj.FileListAbsolute.txt b/Project2/x64/Release/Project2.vcxproj.FileListAbsolute.txt new file mode 100644 index 0000000..e69de29