3.1.2T.pdf - Swinburne University of Technology 2021 Sem 1...

This preview shows page 1 out of 3 pages.

Unformatted text preview: Swinburne University of Technology 2021 Sem 1 Introduction to Programming Doubtfire Submission Name Tester (Silly Name) - Part 2 Submitted By: Duleen Vinnath Weeraratne 103492480 2021/03/18 01:19 March 18, 2021 Produced by Doubtfire Tutor: Muneeb Ul Hassan File 1 of 2 1 code require './input_functions' 2 3 4 5 # you need to complete the following procedure that prints out # "<Name> is a " then print 'silly' (60 times) on one long line # then print ' name.' \newline 6 7 8 9 10 11 12 13 14 15 16 def print_silly_name(name) i = 0 puts(name + " is a") while (i < 60) print (" silly") i = i + 1 end puts(" name!") # complete the code needed here - you will need a loop. end 17 18 19 20 21 22 23 24 25 # copy your code from the previous stage below and # change it to call the procedure above, passing in the name: def main name = read_string("What is your name? ") if name == "Duleen" or name == "Muneeb" puts name + " is an awesome name!" else print_silly_name(name) 26 27 28 end end 29 30 # put your main() from stage one here 31 32 main() Page 1 of 2 File 2 of 2 screen shot Page 2 of 2 ...
View Full Document

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture