diff --git a/01_online_banking_system/01_banco.png b/01_online_banking_system/01_banco.png new file mode 100644 index 00000000..986c6cbd Binary files /dev/null and b/01_online_banking_system/01_banco.png differ diff --git a/01_online_banking_system/main.rb b/01_online_banking_system/main.rb new file mode 100644 index 00000000..c58e2db7 --- /dev/null +++ b/01_online_banking_system/main.rb @@ -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 \ No newline at end of file diff --git a/02_currency_converter/exchange.png b/02_currency_converter/exchange.png new file mode 100644 index 00000000..a1769911 Binary files /dev/null and b/02_currency_converter/exchange.png differ diff --git a/02_currency_converter/main.rb b/02_currency_converter/main.rb new file mode 100644 index 00000000..08b745c3 --- /dev/null +++ b/02_currency_converter/main.rb @@ -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 \ No newline at end of file diff --git a/03_university_enrollment/main.rb b/03_university_enrollment/main.rb new file mode 100644 index 00000000..ed87e732 --- /dev/null +++ b/03_university_enrollment/main.rb @@ -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 \ No newline at end of file diff --git a/level_0.txt b/level_0.txt index 46810130..8e24756e 100644 --- a/level_0.txt +++ b/level_0.txt @@ -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. @@ -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.