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