Question: require 'date' require './input_functions' # Multiply metres by the following to get inches: INCHES = 39.3701 # Insert into the following your hello_user code #

 require 'date' require './input_functions' # Multiply metres by the following to

require 'date'

require './input_functions'

# Multiply metres by the following to get inches:

INCHES = 39.3701

# Insert into the following your hello_user code

# from task 1.3P and modify it to use the functions

# in input_functions

def main()

# HOW TO USE THE input_functions CODE

# Example of how to read strings:

s = read_string('Enter a String: ')

puts("the string you entered was: " + s)

# Example of how to read integers:

i = read_integer('Enter an Integer: ')

puts("The Integer you entered was: " + i.to_s)

# Example of how to read floats:

f = read_float('Enter a float (eg: 3.142): ')

puts("The Float you entered was: " + f.to_s)

# Get the curent year from the system:

y = Date.today.year

puts("the current year is: " + y.to_s)

# Now if you know how to do all that

# Copy in your code from your completed

# hello_user Task 1.3 P. Then modify it to

# use the code in input_functions.

# use read_string for all strings (this will

# remove all whitespace)

end

main()

In this task, you need to use the functions in the library to create a simple interactive program. This is a variation on your previous Hello User task. The output should look as follows: The steps needed are: Use the functions in input_functions.rb to do the following: Read the user's name (a String, prompt with 'Please enter your name: ') and store it in the name variable. Print out the user's name followed by an exclamation mark. Read the user's tamily name and store it in the variable. Print out the user's family_name followed by an exclamation mark. Read in the user's year of birth as an integer Calculate the user's age and print it out. Prompt for and read in the user's height in metres as a float Convert the height to inches and print out the result. Use the constant at the top of the code to convert metres to inches Call the function from passing in the argument 'Do you want to continue?' If the read_boolean function returns true then display 'OK, lets continue ', if the function returns false then output 'ok, goodbye. This should look as follows

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!