Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .gitignore
Empty file.
Binary file added INSTALL.md
Binary file not shown.
Binary file modified README.md
Empty file added gitignore
Empty file.
17 changes: 17 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>

<head>
<title>Program 3</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<!-- Labels (some text) and inputs (text and colorpicker) inside the form. -->
<body>
<form>
<label id="uname">Please enter your username: </label> <input type="text" id="username" name="username">
<br>
<label id="pword"> Enter your password: </label> <input type="password" id="password" name="password">
<br>
<label id="color"> Please pick your favorite color: </label> <input type = "color" id = "colorpick" name="colorpick" value="#d57e00"/>
</form>

</body>
40 changes: 40 additions & 0 deletions program1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import sys

money = sys.argv[1]

# Replaces the first instance only of "$" and ".". Nothing happens if they don't exist.
money1 = (money.replace("$", "", 1).replace(".", "", 1))

if money1.isdigit():
sum = int(money1) # Makes money1 an integer if money1 is a number.
if sum < 0 or sum > 10000:
print("Error, value must be between 0 and 100 dollars.")
else:
# Dictionary to store the value of each currency.
coins = {
"Dollar": sum // 100,
"Quarter": (sum % 100) // 25,
"Dime": (sum % 25) // 10,
"Nickel": (sum % 10) // 5,
"Penny": (sum % 5)
}
# Another format check, but for the initial variable.
if money[0] != "$" or ("." not in money):
print("Error please provide in the correct format '$x.yz' for x, y, z in positive integers.")
else:
# For key, value in coins
for i, j in coins.items():
if j > 0: # Only if the value is greater than 0 it gets printed. E.g. 0 dollars won't get printed.
# To correctly grammatically format (dollar vs dollars):
if j == 1:
print(f"{j} {i}")
else: # j > 1 formatting for duplicate currencies.
if i == "Penny":
print(f"{j} Pennies") # Need to print j pennies, not j penny if multiple exist.
else:
print(f"{j} {i}s") # Adding s at the end works for every other currency.


else:
# If amount is not in valid format:
print("Error please provide in the correct format '$x.yz' for x, y, z in positive integers.")
27 changes: 27 additions & 0 deletions program2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
strings = process.argv.slice(2);

// Check if there are no strings provided or if the array is empty
if (!strings || !strings.length) {
console.log("ERROR: You must provide at least one string");
}
let wordCounts = new Map();
let sentence = strings.join(" ").split(" ");

for (let word of sentence) {
// Convert the word to lowercase for case-insensitive comparison
if (wordCounts.has(word.toLowerCase())) {
// If the word already exists in the wordCounts object, increment its count by 1
wordCounts.get(word.toLowerCase())[1] += 1;
} else {
// If the word doesn't exist in the wordCounts object, add it with a count of 1
wordCounts.set(word.toLowerCase(), [word, 1]);
}
}

for (let word of wordCounts.keys()) {
// Check if the count of the word is greater than or equal to 2
if (wordCounts.get(word)[1] >= 2) {
// If the count is greater than or equal to 2, print the word
console.log(wordCounts.get(word)[0]);
}
}
24 changes: 24 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
body{
display: flex;
flex-direction: column;
align-items: center;
height: 95vh;
justify-content: center;
font-family: Verdana;
font-size: 24pt;
background-color: #346094;
color: #000000;
}

/* vw and vh are % of viewport width/height. The last 3 lines center. */
form{
outline: auto;
outline-color: #000000;
background-color: #8a8a8d;
width: 80vw;
height: 70vh;
display:flex;
flex-direction: column;
align-items: center;
justify-content: center;
}