Programming with ruby (on the way)

Is the output

I am programming using ruby by making use of what I learned last time.

I'm still in the middle of it, but this time I would like to make a profit calculation for the store I learned from MUP. Actually, the plan to finish it quickly seems to be long enough to make a plan. .. ..

For the time being, the following is on the way

def input_data(total_datas)
  puts "Please enter the store name"
    store_name = gets.chomp
  puts "Weekday lunch guests"
    weekday_lunch_guest = gets.to_i
  puts "Weekday dinner guests"
    weekday_dinner_guest = gets.to_i
  puts "Number of guests for holiday lunch"
    weekend_lunch_guest = gets.to_i
  puts "Number of guests for holiday dinner"
    weekday_dinner_guest = gets.to_i
  puts "Weekday lunch customer unit price"
    weekday_lunch_guest_price = gets.to_i
  puts "Weekday dinner customer unit price"
    weekday_dinner_guest_price = gets.to_i
  puts "Holiday lunch customer unit price"
    weekend_lunch_guest_price = gets.to_i
  puts "Holiday dinner customer unit price"
    weekend_dinner_guest_price = gets.to_i
  puts "Weekday business days"
    weekday_business = gets.to_i
  puts "Holiday business days"
    weekend_business = gets.to_i
  puts "Lunch cost"
    lunch_cost = gets.to_i
  puts "Dinner cost"
    dinner_cost = gets.to_i
  puts "Please enter the rent"
    rent = gets.to_i
  puts "Please enter the utility bill"
    utility_cost = gets.to_i
  puts "Please enter the labor cost"
    saraly = gets.to_i
  puts "Please enter your monthly purchase"
    stocking = gets.to_i

  total_data = {store_name: store_name, weekday_lunch_guest: weekday_lunch_guest, weekday_dinner_guest: weekday_dinner_guest, weekend_lunch_guest: weekend_lunch_guest, weekday_dinner_guest: weekday_dinner_guest, weekday_lunch_guest_price: weekday_lunch_guest_price,  weekday_dinner_guest_price:  weekday_dinner_guest_price, weekend_lunch_guest_price: weekend_lunch_guest_price, weekend_dinner_guest_price: weekend_dinner_guest_price, weekday_business: weekday_business, weekend_business: weekend_business, lunch_cost: lunch_cost, dinner_cost: dinner_cost, rent: rent, utility_cost: utility_cost, saraly: saraly, stocking: stocking}

  total_datas << total_data
end

def show_store(total_datas)
  total_datas.each_with_index do |total_data, i|
    puts "[#{i}]: #{total_data[:store_name]}"
  end

  puts "Please enter the number you want to check."
  input = gets.to_i
  total_data = total_datas[input]

  if total_data
    show_data(total_data)
  else
    puts "There is no corresponding number."
  end
end

def show_data(total_data)
end




def end_program
  exit
end

def exception
  puts "The value entered is an invalid value"
end

total_datas = []

while true do
  puts "Please enter the number"
  puts "[0]Register the store"
  puts "[1]Refer to the data"
  puts "[2]Quit the app"
    input = gets.to_i

  if input == 0 then
    input_data
  elsif input == 1 then
    show_store(total_datas)
  elsif input == 2 then
    end_program
  else
    exception
  end
end

with show_data (total_data) I would like to create something like calculating the numerical values of the values in the hash one by one and finally making a profit forecast. Well, Excel is quicker, but lol

Recommended Posts

Programming with ruby (on the way)
Determine the current page with Ruby on Rails
Install Ruby on MSYS2 with pacman
Install ruby on Ubuntu 20.04 with rbenv
The difference between programming with Ruby classes and programming without it
Understand code coverage with Rspec, the Ruby on Rails test framework
[Ruby on Rails] View test with RSpec
Notes on using FCM with Ruby on Rails
[Ruby on Rails] Controller test with RSpec
Solving the knapsack problem with dynamic programming
[Ruby on Rails] Model test with RSpec
Using templates on the classpath with Apache Velocity
Migration from Eclipse to IntelliJ (on the way)
Come out with a suffix on the method
Introducing Rspec with Ruby on Rails x Docker
When the Ruby on Rails terminal rolls back
Manage the version of Ruby itself with rbenv
[Competition Pro] Solve the knapsack problem with Ruby
Come out with a suffix on the method 2
Matches annotations on the interface with Spring AOP
[Rails] Procedure for linking databases with Ruby On Rails
[Ruby on Rails] Upload multiple images with refile
I checked the number of taxis with Ruby
I made a portfolio with Ruby On Rails
[Ruby] Basic code list. Keep the basics with examples
Feel the basic type and reference type easily with ruby
[Ruby on Rails] Delete s3 images with Active Strage
Run Ruby on Rails RSpec tests with GitHub Actions
[Ruby on Rails] How to change the column name
[At Coder] Solve the ABC183 D problem with Ruby
Install Ruby on Ubuntu 20.04
Getting Started with Ruby
Display the list in setDetails on the screen with spring-security
Ruby on Rails Elementary
Ruby on Rails basics
Feel the basic type and reference type easily with ruby 2
Install rbenv with apt on ubuntu and put ruby
[At Coder] Solve the ABC182 D problem with Ruby
Ruby On Rails Association
(Ruby on Rails6) Reflecting the posted content from the form
Created RSS / Atom format sitemap with Ruby on Rails
Evolve Eevee with Ruby
Try using the query attribute of Ruby on Rails
[Ruby on Rails] Only the user who posted can edit
I tried installing Ruby on Rails related plugin with vim-plug
I immediately stumbled on the standard input method with AtCoder.
Hello World with Ruby extension library for the time being
[Ruby on Rails] Add a column with a foreign key constraint
[Ruby on Rails] Quickly display the page title in the browser
Four-in-a-row with gravity that can be played on the console
[Swift 5] Select a date with the IDate Picker on iOS14
(Ruby on Rails6) Display of the database that got the id of the database
Delete all the contents of the list page [Ruby on Rails]
A note about the seed function of Ruby on Rails
Until the production deployment of hello-app with k3d on Time4VPS
[Ruby on Rails] Automatically enter the address from the zip code
[Ruby on Rails] Implement login function by add_token_to_users with API
[Note] About the Fizz_Buzz problem (How Ruby on Rails works)
Ruby / rexml: Turn each with an element with the same name
Time is wrong with the application launched on the Docker container
Ruby on rails learning record -2020.10.03