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
Binary file added 01_online_banking_system/01_banco.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 72 additions & 0 deletions 01_online_banking_system/main.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
=begin
1. Create an online banking system with the following features:

1.1 Users must be able to log in with a username and password.
1.2 If the user enters the wrong credentials three times, the system must lock them out.
2.0 The initial balance in the bank account is $2000.
2.1 The system must allow users to deposit, withdraw, view, and transfer money.
2.2 The system must display a menu for users to perform transactions.
=end



number_attemps = 0;
validPassword = "123"
validUsername = "batman"
initialValance = 2000
flag = true

max_attemps = 3

loop do
print "What is your username? "
username = gets.chomp
print "What is your password? "
password = gets.chomp

if password == validPassword && username == validUsername

loop do

puts "Welcome"
puts "1.Deposit"
puts "2.withdraw"
puts "3. view"
puts "4. transfer"
puts "5. exit"

option = gets.chomp.to_i
if option == 1
puts "Insert the ammount to insert"
ammount = gets.chomp
initialValance += ammount.to_i

elsif option == 2
puts "insert the amount to withdraw"
withdraw = gets.chomp
initialValance -= withdraw.to_i
elsif option == 3
puts "Your total is #{initialValance}"
elsif option == 4
puts "Account to transfer: "
account = gets.chomp
puts "Amount to transfer: "
amount = gets.chomp
initialValance -= amount.to_i

elsif option == 5
print "THANKS FOR USING OUR SERVICES"
flagExit = false
flag = false

end
break if option == 5

end

else
number_attemps +=1
end
break if max_attemps == number_attemps

end
Binary file added 02_currency_converter/exchange.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 74 additions & 0 deletions 02_currency_converter/main.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
percentageAverage = 1
isFinishProgram = 0

def print_menu(title)
puts title
puts "CLP"
puts "ARS"
puts "USD"
puts "EUR"
puts "TRY"
puts "GBP"
end

def data_insert_to_number
return gets.chomp.to_i
end

def calculateExchange (amount, value)
puts amount
puts value
return amount * value
end

def calculateCommision(percentageAverage, exchange)
return (( percentageAverage * exchange) / 100 ).round
end


curencies = {
"CLP" => 12.21,
"ARG" =>9,
"USD" => 12,
"EUR" => 1.50,
"TRY" => 221,
"GBP" => 2
}

until isFinishProgram == 1

puts "**** WELCOME****"
puts "Insert the amount to convert: "
amount = data_insert_to_number

print_menu("Select your currency ")
currency = gets.chomp

print_menu("Select the currenct to exchange: ")
currencyToExchange = gets.chomp

exchange = calculateExchange(amount, curencies[currency])

puts exchange
puts "The exchange from #{currency} to #{currencyToExchange} is #{exchange}"
puts "Do you want to withdraw the funds?"
puts "1. Yes"
puts "2. No"

isWithdraw = gets.chomp

if isWithdraw == 1

total =calculateCommision(percentageAverage, )
puts total
else
puts "Do you want to perform another operation?"
puts "1. Yes"
puts "2. No"
isExit = gets.chomp
if isExit == "2"
puts "Thanks"
isFinishProgram = 1
end
end
end
39 changes: 39 additions & 0 deletions 03_university_enrollment/main.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

programs = {
cs: 0 ,
medine: 1,
marketing: 0,
arts: 3
}

puts "Username :"
username = gets.chomp
puts "Password: "
password = gets.chomp

if username == "admin" && password == "admin"
puts "Chose the program you want"
puts "1. Computer Science"
puts "2. Medicine"
puts "3. Marketing"
puts "4. Arts"

choice = gets.chomp
puts choice
puts choice.class
case choice
when "1"
if programs[:cs] == 0
puts "Sin expacios disponibles"
else
puts programs[:cs] = programs[:cs] - 1
end
when "2"

end
puts programs

# Computer Science, Medicine, Marketing, and Arts.
else
puts "Invalid username or password"
end
4 changes: 2 additions & 2 deletions level_0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Username: @blindma1den
* If the user enters the wrong credentials three times, the system must lock them out.
* The initial balance in the bank account is $2000.
* The system must allow users to deposit, withdraw, view, and transfer money.
* The system must display a menu for users to perform transactions.


2.
* The system must display a menu for users to perform transactions.

2. Create a currency converter between CLP, ARS, USD, EUR, TRY, GBP with the following features:
* The user must choose their initial currency and the currency they want to exchange to.
Expand All @@ -32,7 +32,7 @@ Username: @blindma1den
* To send a package, sender and recipient details are required.
* The system assigns a random package number to each sent package.
* The system calculates the shipping price. $2 per kg.
* The user must input the total weight of their package, and the system should display the amount to pay.


* The user must input the total weight of their package, and the system should display the amount to pay.
* The system should ask if the user wants to perform another operation. If the answer is yes, it should return to the main menu. If it's no, it should close the system.


Expand Down