added old projects

This commit is contained in:
Austin Bennett
2026-02-03 08:18:39 -06:00
parent 43acf989bf
commit 2451448b8a
623 changed files with 28117 additions and 0 deletions
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
1200.43 .08 60
@@ -0,0 +1,107 @@
//
// main.cpp
// CompoundingInterest
//
// Created by Austin Bennett on 6/19/22.
//
/*
Write a program that read the starting balance, interest rate and number of months from a file.
Example:
1200.43 .08 60
(Balance of $1200.43, 8 percent interest rate, 60 months)
your program will print out a table showing month number and current balance (assume it is compounded monthly) for the number of specified months. Your program should prompt the user for the name of the output file. Use the formatting function you created previously to format the amount. Please note that the output of the program must show balance each month - not just the total at the end.
Example:
0 1,200.43
1 1,208.44
2 1,216.54
etc.
*/
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
string Format(double input) {
char result[] {};
// resultIndex will handle what goes where in our output
int resultIndex = 0;
//Making the input nice to work with
std::string inputString = to_string(input);
char num[inputString.length() + 1];
strcpy(num, inputString.c_str());
// characteristic is all the numbers on the right of the decimal point
char* characteristic = strtok(num, ".");
int characteristicLen = strlen(characteristic);
int characteristicIndex {0};
// this adds the commas
for (int i = characteristicLen - 1 ; i >= 0; i--) {
bool isComma = ((i + 1) % 3 == 0);
if (isComma) {
result[resultIndex] = ',';
resultIndex++;
result[resultIndex] = characteristic[characteristicIndex];
characteristicIndex++;
resultIndex++;
} else {
result[resultIndex] = characteristic[characteristicIndex];
characteristicIndex++;
resultIndex++;
}
}
//adds the decimal
result[resultIndex] = '.';
resultIndex++;
// creates the mantissa
characteristic = strtok(NULL, ".");
//adds the decimals
for (int i = 0; i <= 1; i++) {
result[resultIndex] = characteristic[i]; // the mantissa's value at index i
resultIndex++;
characteristicIndex++;
}
//builds out the result
string s = "";
for (size_t i = 0; i < resultIndex; i++) {
s = s + result[i];
}
return s;
}
int main()
{
// Get intial values
float newBalance, interestRate, months, oldBalance;
fstream input("/Users/austin/Documents/School/Summer 2022/CSC 122/CompoundingInterest/CompoundingInterest/input.txt", ios_base::in);
input >> oldBalance >> interestRate >> months;
// Build the output file
string fileName;
cout << "Enter File Name (No extension): ";
cin >> fileName;
ofstream output;
output.open ("/Users/austin/Documents/School/Summer 2022/CSC 122/CompoundingInterest/CompoundingInterest/" + fileName + ".txt");
//Assuming the first month counts as one of the input months
output << "0 " << Format(oldBalance) << endl;
for (int i = 1; i < months; i++) {
newBalance = ( 1 + interestRate / 12 ) * oldBalance;
output << i << " " << Format(newBalance) << endl;
oldBalance = newBalance;
}
}
@@ -0,0 +1,60 @@
0 1,200.43
1 1,208.43
2 1,216.48
3 1,224.59
4 1,232.76
5 1,240.98
6 1,249.25
7 1,257.58
8 1,265.96
9 1,274.40
10 1,282.90
11 1,291.45
12 1,300.06
13 1,308.73
14 1,317.45
15 1,326.24
16 1,335.08
17 1,343.98
18 1,352.94
19 1,361.96
20 1,371.04
21 1,380.18
22 1,389.38
23 1,398.64
24 1,407.96
25 1,417.35
26 1,426.80
27 1,436.31
28 1,445.89
29 1,455.53
30 1,465.23
31 1,475.00
32 1,484.83
33 1,494.73
34 1,504.70
35 1,514.73
36 1,524.83
37 1,534.99
38 1,545.22
39 1,555.53
40 1,565.90
41 1,576.34
42 1,586.84
43 1,597.42
44 1,608.07
45 1,618.79
46 1,629.59
47 1,640.45
48 1,651.39
49 1,662.39
50 1,673.48
51 1,684.63
52 1,695.86
53 1,707.17
54 1,718.55
55 1,730.01
56 1,741.54
57 1,753.15
58 1,764.84
59 1,776.61
@@ -0,0 +1,284 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 55;
objects = {
/* Begin PBXBuildFile section */
D9A8F12628602FE00025DE2F /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D9A8F12528602FE00025DE2F /* main.cpp */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
D9A8F12028602FE00025DE2F /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = /usr/share/man/man1/;
dstSubfolderSpec = 0;
files = (
);
runOnlyForDeploymentPostprocessing = 1;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
D9A8F12228602FE00025DE2F /* CompoundingInterest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = CompoundingInterest; sourceTree = BUILT_PRODUCTS_DIR; };
D9A8F12528602FE00025DE2F /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
D9A8F12C2860CA360025DE2F /* input.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = input.txt; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
D9A8F11F28602FE00025DE2F /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
D9A8F11928602FDF0025DE2F = {
isa = PBXGroup;
children = (
D9A8F12428602FE00025DE2F /* CompoundingInterest */,
D9A8F12328602FE00025DE2F /* Products */,
);
sourceTree = "<group>";
};
D9A8F12328602FE00025DE2F /* Products */ = {
isa = PBXGroup;
children = (
D9A8F12228602FE00025DE2F /* CompoundingInterest */,
);
name = Products;
sourceTree = "<group>";
};
D9A8F12428602FE00025DE2F /* CompoundingInterest */ = {
isa = PBXGroup;
children = (
D9A8F12528602FE00025DE2F /* main.cpp */,
D9A8F12C2860CA360025DE2F /* input.txt */,
);
path = CompoundingInterest;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
D9A8F12128602FE00025DE2F /* CompoundingInterest */ = {
isa = PBXNativeTarget;
buildConfigurationList = D9A8F12928602FE00025DE2F /* Build configuration list for PBXNativeTarget "CompoundingInterest" */;
buildPhases = (
D9A8F11E28602FE00025DE2F /* Sources */,
D9A8F11F28602FE00025DE2F /* Frameworks */,
D9A8F12028602FE00025DE2F /* CopyFiles */,
);
buildRules = (
);
dependencies = (
);
name = CompoundingInterest;
productName = CompoundingInterest;
productReference = D9A8F12228602FE00025DE2F /* CompoundingInterest */;
productType = "com.apple.product-type.tool";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
D9A8F11A28602FDF0025DE2F /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = 1;
LastUpgradeCheck = 1340;
TargetAttributes = {
D9A8F12128602FE00025DE2F = {
CreatedOnToolsVersion = 13.4.1;
};
};
};
buildConfigurationList = D9A8F11D28602FDF0025DE2F /* Build configuration list for PBXProject "CompoundingInterest" */;
compatibilityVersion = "Xcode 13.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = D9A8F11928602FDF0025DE2F;
productRefGroup = D9A8F12328602FE00025DE2F /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
D9A8F12128602FE00025DE2F /* CompoundingInterest */,
);
};
/* End PBXProject section */
/* Begin PBXSourcesBuildPhase section */
D9A8F11E28602FE00025DE2F /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
D9A8F12628602FE00025DE2F /* main.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
D9A8F12728602FE00025DE2F /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 12.3;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
name = Debug;
};
D9A8F12828602FE00025DE2F /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 12.3;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
};
name = Release;
};
D9A8F12A28602FE00025DE2F /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = N3GD25M5J3;
ENABLE_HARDENED_RUNTIME = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
D9A8F12B28602FE00025DE2F /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = N3GD25M5J3;
ENABLE_HARDENED_RUNTIME = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
D9A8F11D28602FDF0025DE2F /* Build configuration list for PBXProject "CompoundingInterest" */ = {
isa = XCConfigurationList;
buildConfigurations = (
D9A8F12728602FE00025DE2F /* Debug */,
D9A8F12828602FE00025DE2F /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
D9A8F12928602FE00025DE2F /* Build configuration list for PBXNativeTarget "CompoundingInterest" */ = {
isa = XCConfigurationList;
buildConfigurations = (
D9A8F12A28602FE00025DE2F /* Debug */,
D9A8F12B28602FE00025DE2F /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = D9A8F11A28602FDF0025DE2F /* Project object */;
}
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "6562050E-6DA9-4961-9E62-10E7BE6E4F66"
type = "1"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "112F048C-AD5D-4364-8B24-A19B9AC678CA"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "CompoundingInterest/input.h"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "15"
endingLineNumber = "15"
landmarkName = "ReadValue(prompt)"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>CompoundingInterest.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
1200.43 .08 60
@@ -0,0 +1,107 @@
//
// main.cpp
// CompoundingInterest
//
// Created by Austin Bennett on 6/19/22.
//
/*
Write a program that read the starting balance, interest rate and number of months from a file.
Example:
1200.43 .08 60
(Balance of $1200.43, 8 percent interest rate, 60 months)
your program will print out a table showing month number and current balance (assume it is compounded monthly) for the number of specified months. Your program should prompt the user for the name of the output file. Use the formatting function you created previously to format the amount. Please note that the output of the program must show balance each month - not just the total at the end.
Example:
0 1,200.43
1 1,208.44
2 1,216.54
etc.
*/
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
string Format(double input) {
char result[] {};
// resultIndex will handle what goes where in our output
int resultIndex = 0;
//Making the input nice to work with
std::string inputString = to_string(input);
char num[inputString.length() + 1];
strcpy(num, inputString.c_str());
// characteristic is all the numbers on the right of the decimal point
char* characteristic = strtok(num, ".");
int characteristicLen = strlen(characteristic);
int characteristicIndex {0};
// this adds the commas
for (int i = characteristicLen - 1 ; i >= 0; i--) {
bool isComma = ((i + 1) % 3 == 0);
if (isComma) {
result[resultIndex] = ',';
resultIndex++;
result[resultIndex] = characteristic[characteristicIndex];
characteristicIndex++;
resultIndex++;
} else {
result[resultIndex] = characteristic[characteristicIndex];
characteristicIndex++;
resultIndex++;
}
}
//adds the decimal
result[resultIndex] = '.';
resultIndex++;
// creates the mantissa
characteristic = strtok(NULL, ".");
//adds the decimals
for (int i = 0; i <= 1; i++) {
result[resultIndex] = characteristic[i]; // the mantissa's value at index i
resultIndex++;
characteristicIndex++;
}
//builds out the result
string s = "";
for (size_t i = 0; i < resultIndex; i++) {
s = s + result[i];
}
return s;
}
int main()
{
// Get intial values
float newBalance, interestRate, months, oldBalance;
fstream input("/Users/austin/Documents/School/Summer 2022/CSC 122/CompoundingInterest/CompoundingInterest/input.txt", ios_base::in);
input >> oldBalance >> interestRate >> months;
// Build the output file
string fileName;
cout << "Enter File Name (No extension): ";
cin >> fileName;
ofstream output;
output.open ("/Users/austin/Documents/School/Summer 2022/CSC 122/CompoundingInterest/CompoundingInterest/" + fileName + ".txt");
//Assuming the first month counts as one of the input months
output << "0 " << Format(oldBalance) << endl;
for (int i = 1; i < months; i++) {
newBalance = ( 1 + interestRate / 12 ) * oldBalance;
output << i << " " << Format(newBalance) << endl;
oldBalance = newBalance;
}
}
@@ -0,0 +1,60 @@
0 1,200.43
1 1,208.43
2 1,216.48
3 1,224.59
4 1,232.76
5 1,240.98
6 1,249.25
7 1,257.58
8 1,265.96
9 1,274.40
10 1,282.90
11 1,291.45
12 1,300.06
13 1,308.73
14 1,317.45
15 1,326.24
16 1,335.08
17 1,343.98
18 1,352.94
19 1,361.96
20 1,371.04
21 1,380.18
22 1,389.38
23 1,398.64
24 1,407.96
25 1,417.35
26 1,426.80
27 1,436.31
28 1,445.89
29 1,455.53
30 1,465.23
31 1,475.00
32 1,484.83
33 1,494.73
34 1,504.70
35 1,514.73
36 1,524.83
37 1,534.99
38 1,545.22
39 1,555.53
40 1,565.90
41 1,576.34
42 1,586.84
43 1,597.42
44 1,608.07
45 1,618.79
46 1,629.59
47 1,640.45
48 1,651.39
49 1,662.39
50 1,673.48
51 1,684.63
52 1,695.86
53 1,707.17
54 1,718.55
55 1,730.01
56 1,741.54
57 1,753.15
58 1,764.84
59 1,776.61
Binary file not shown.
Binary file not shown.