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.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
# Git Lab 1
# HUGH GLENN
<ins>**RESOURCES**<ins>

-Saksham

-StackOverflow

-W3 Schools

-Elyz Katz

-GeeksforGeeks
Empty file added gitignore
Empty file.
82 changes: 82 additions & 0 deletions program1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import sys
import decimal

#Reads string off command line
DollarAmount = sys.argv[1]


#Error Check
if len(sys.argv) > 2:
print("Only one argument (money) should be allowed")
sys.exit(-1)

#Checks if the argument is a valid string
if DollarAmount[0] != '$':
print('The string must being with a $')
sys.exit(-1)
elif DollarAmount[1] == '.':
print('The string must include a dollar amount')
sys.exit(-1)

#Converts string into money in terms of cents and creates dictionary of coins/dollar
#Also checks to see if string can be convrted
try:
float(DollarAmount[1:])
except:
print('Only input numbers after the dollar symbol')
sys.exit(-1)
DollarAmount = float(DollarAmount[1:]) * 100
Coins = {}

#Error check to see if number is valid
if (DollarAmount < 0 or DollarAmount > 100 * 100):
print('The dollar amount must be a number 0 - 100')
sys.exit(-1)
if (DollarAmount % 1 != 0):
print('Only valid dollar amounts')
sys.exit(-1)



#Sorts through all the money values and sees how many are inside
if DollarAmount // 100 == 1:
Coins['Dollar'] = 1
DollarAmount -= DollarAmount // 100 * 100
elif DollarAmount // 100 > 1:
Coins['Dollars'] = DollarAmount // 100
DollarAmount -= DollarAmount // 100 * 100
DollarAmount = round(DollarAmount)

if DollarAmount // 25 == 1:
Coins['Quarter'] = 1
DollarAmount -= DollarAmount // 25 * 25
elif DollarAmount // 25 > 1:
Coins['Quarters'] = DollarAmount // 25
DollarAmount -= DollarAmount // 25 * 25
DollarAmount = round(DollarAmount)

if DollarAmount // 10 == 1:
Coins['Dime'] = 1
DollarAmount -= DollarAmount // 10 * 10
elif DollarAmount // 10 > 1:
Coins['Dimes'] = DollarAmount // 10
DollarAmount -= DollarAmount // 10 * 10
DollarAmount = round(DollarAmount)

if DollarAmount // 5 == 1:
Coins['Nickel'] = 1
DollarAmount -= DollarAmount // 5 * 5
elif DollarAmount // 5 > 1:
Coins['Nickels'] = DollarAmount // 5
DollarAmount -= DollarAmount // 5 * 5
DollarAmount = round(DollarAmount)

if DollarAmount // 1 == 1:
Coins['Penny'] = 1
DollarAmount -= DollarAmount // 1
elif DollarAmount // 1 > 1:
Coins['Pennies'] = DollarAmount // 1
DollarAmount -= DollarAmount // 1

for key in Coins:
print(int(Coins[key]), key)
59 changes: 59 additions & 0 deletions program2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
//Creates json of lower case letters indicating capitalized string, and array of letters that are printed out
let letters = {}
let rtn = []

//Error case
if (process.argv.length == 2){
console.log('ERROR: You must provide at least one string')
return
}

/**
* @params String with spaces in it
*
*
* Sorts duplicates into the array and words into the json,
* but accounts for the string being multiple words with spaces inbetween
*
*/
function SpacedString(Sentence){
let input = ''
for (let i = 0; i < Sentence.length; i++){
if (Sentence[i] == ' '){
if (Object.hasOwn(letters, input.toLowerCase())){
rtn.push(letters[input.toLocaleLowerCase()])
}else{
letters[input.toLowerCase()] = input
}
input = ''
}else{
input += Sentence[i]
}
}
if (Object.hasOwn(letters, input.toLowerCase())){
rtn.push(letters[input.toLocaleLowerCase()])
}else{
letters[input.toLowerCase()] = input
}
}

//Adds all duplicates to array
for (let i = 2; i < process.argv.length; ++i) {
LowercaseString = process.argv[i].toLowerCase()
Word = process.argv[i]
if (Word.includes(' ')){
SpacedString(Word)
}
else if (Object.hasOwn(letters, LowercaseString)){
if (rtn.includes(letters[LowercaseString]) == false)
rtn.push(letters[LowercaseString])
}
else{
letters[LowercaseString] = Word
}
}

//Prints out all duplicate strings
for (let i = 0; i < rtn.length; i++){
console.log(rtn[i])
}
34 changes: 34 additions & 0 deletions program3.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*The rectangle that holds all the choices*/
#maincontainer{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
border: solid black 1px;
width: 80vw;
height: 70%;
text-align: center;
display: flex;
flex-direction: column;
justify-content: space-around;
}

/*Main background*/
body{
background-color: gray;
}

/*The background of the form*/
div{
background-color: blue;
}

/*The text inside the form*/
label{
color: #FFFFFF;
padding: 1%;
}

input{
padding: 1%;
}
27 changes: 27 additions & 0 deletions program3.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<html>
<head>
<link rel="stylesheet" href="program3.css">
</head>
<body>
<div id="maincontainer">
<div>
<label for="Username">
Enter Username:
</label>
<input type="text" id="Username">
</div>
<div>
<label for="Password">
Enter Password:
</label>
<input type="text" id="Password">
</div>
<div>
<label for="Color">
Choose Color:
</label>
<input type="color" id="Color">
</div>
</div>
</body>
</html>