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)
Publish the app made with ruby on rails
Determine the current page with Ruby on Rails
Solve the N + 1 problem with Ruby on Rails: acts-as-taggable-on
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
Do your best with gRPC with ruby ​​on the server and PHP on the client
Using templates on the classpath with Apache Velocity
[Ruby on Rails] Until the introduction of RSpec
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] Exclude duplicate elements with the uniq method.
[Ruby on Rails] Upload multiple images with refile
Finding pi with the Monte Carlo method? (Ruby)
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
Install Ruby 3.0.0 with asdf
Feel the basic type and reference type easily with ruby
[Ruby on Rails Tutorial] Error in the test in Chapter 3
Docker the development environment of Ruby on Rails project
[Ruby on Rails] Delete s3 images with Active Strage
[Ruby On Rails] How to use simple_format to display the entered text with line breaks
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
"Experience" reactive programming with NoSQL (touch the Couchbase Reactive API)
Display the list in setDetails on the screen with spring-security
Ruby on Rails Elementary
Ruby on Rails basics
Challenge the settings for developing with vue.js on Rails 6
Feel the basic type and reference type easily with ruby 2
Install rbenv with apt on ubuntu and put ruby
Save image data with AWS_S3 + Ruby on Rails_Active Storage
[At Coder] Solve the ABC182 D problem with Ruby
Ruby On Rails Association
(Ruby on Rails6) Reflecting the posted content from the form
11th, Classification with Ruby
About the [ruby] operator
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.