Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Objective-C and Swift
  4. Can anyone help me solve this project?

Can anyone help me solve this project?

Scheduled Pinned Locked Moved Objective-C and Swift
helpquestion
4 Posts 4 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 11542833
    wrote on last edited by
    #1

    Declare and set a variable called myName to your name Declare two more string variables introduction and japaneseIntroduction both with an NSString type Set introduction using stringWithFormat class method "My name is %@", myName Set japanese introduction using stringByAppendingString instance method by appending " to moushimasu" Print introduction and japanese introduction Step 3: Define and call a new function Declare a function called printIntroductions The function should accept an NSString as a parameter called name Cut and paste the introduction and japaneseIntroduction code inside of the new function You should have errors for referencing 'myName'. Change any reference to 'myName' to 'name'. This is an error of scope. You only declared 'myName' in your didFinishLaunching method. Not in your new method. In your new method, you declared an argument called 'name' that your function accepts when the method is called In your didFinishLaunching method after you set myName call printIntroductions: and pass in 'myName' as an argument It should print out the introduction and Japanese introduction Step 4: Recurse through a function Add a new function called countDownTillIntroduction: that accepts an integer called numberOfDays as an argument The function should do the following: Check to see if the numberOfDays is 0 If the number of days is 0, it should print "The time has come" If numberOfDays is not 0 It should print "[numberOfDays] days left until introductions" It should declare and set a variable oneLessDay and set it to numberOfDays - 1 It should then call countDownTillIntroduction and pass in oneLessDay In the didFinishLaunching method before you call printIntroductions call countDownTillIntroduction and pass in 4 Completion: OUTPUT: You should see it print "4 days left until introductions", "3 days left until introductions" (down to 1) and then it should print "The time has come" and "My name is [yourName]", "[yourName] to moushimasu"

    S D P 3 Replies Last reply
    0
    • U User 11542833

      Declare and set a variable called myName to your name Declare two more string variables introduction and japaneseIntroduction both with an NSString type Set introduction using stringWithFormat class method "My name is %@", myName Set japanese introduction using stringByAppendingString instance method by appending " to moushimasu" Print introduction and japanese introduction Step 3: Define and call a new function Declare a function called printIntroductions The function should accept an NSString as a parameter called name Cut and paste the introduction and japaneseIntroduction code inside of the new function You should have errors for referencing 'myName'. Change any reference to 'myName' to 'name'. This is an error of scope. You only declared 'myName' in your didFinishLaunching method. Not in your new method. In your new method, you declared an argument called 'name' that your function accepts when the method is called In your didFinishLaunching method after you set myName call printIntroductions: and pass in 'myName' as an argument It should print out the introduction and Japanese introduction Step 4: Recurse through a function Add a new function called countDownTillIntroduction: that accepts an integer called numberOfDays as an argument The function should do the following: Check to see if the numberOfDays is 0 If the number of days is 0, it should print "The time has come" If numberOfDays is not 0 It should print "[numberOfDays] days left until introductions" It should declare and set a variable oneLessDay and set it to numberOfDays - 1 It should then call countDownTillIntroduction and pass in oneLessDay In the didFinishLaunching method before you call printIntroductions call countDownTillIntroduction and pass in 4 Completion: OUTPUT: You should see it print "4 days left until introductions", "3 days left until introductions" (down to 1) and then it should print "The time has come" and "My name is [yourName]", "[yourName] to moushimasu"

      S Offline
      S Offline
      Sascha Lefevre
      wrote on last edited by
      #2

      What is your expectation here? Do you want someone to write that program for you? That will not happen. You should try it yourself and if you then run into a specific problem, come back, ask a specific question and probably someone can help you with that.

      1 Reply Last reply
      0
      • U User 11542833

        Declare and set a variable called myName to your name Declare two more string variables introduction and japaneseIntroduction both with an NSString type Set introduction using stringWithFormat class method "My name is %@", myName Set japanese introduction using stringByAppendingString instance method by appending " to moushimasu" Print introduction and japanese introduction Step 3: Define and call a new function Declare a function called printIntroductions The function should accept an NSString as a parameter called name Cut and paste the introduction and japaneseIntroduction code inside of the new function You should have errors for referencing 'myName'. Change any reference to 'myName' to 'name'. This is an error of scope. You only declared 'myName' in your didFinishLaunching method. Not in your new method. In your new method, you declared an argument called 'name' that your function accepts when the method is called In your didFinishLaunching method after you set myName call printIntroductions: and pass in 'myName' as an argument It should print out the introduction and Japanese introduction Step 4: Recurse through a function Add a new function called countDownTillIntroduction: that accepts an integer called numberOfDays as an argument The function should do the following: Check to see if the numberOfDays is 0 If the number of days is 0, it should print "The time has come" If numberOfDays is not 0 It should print "[numberOfDays] days left until introductions" It should declare and set a variable oneLessDay and set it to numberOfDays - 1 It should then call countDownTillIntroduction and pass in oneLessDay In the didFinishLaunching method before you call printIntroductions call countDownTillIntroduction and pass in 4 Completion: OUTPUT: You should see it print "4 days left until introductions", "3 days left until introductions" (down to 1) and then it should print "The time has come" and "My name is [yourName]", "[yourName] to moushimasu"

        D Offline
        D Offline
        Dennis E White
        wrote on last edited by
        #3

        Ok so be honest here. This is codeproject.com not homeworkcheat.com. If you are having some problems and need help with a question about then ask but include the work you have completed and where you are stuck. everyone here is and has taken the effort to learn what is they do. you should be expected to the same if you ever expect to be successful. Learning is a part of life.

        1 Reply Last reply
        0
        • U User 11542833

          Declare and set a variable called myName to your name Declare two more string variables introduction and japaneseIntroduction both with an NSString type Set introduction using stringWithFormat class method "My name is %@", myName Set japanese introduction using stringByAppendingString instance method by appending " to moushimasu" Print introduction and japanese introduction Step 3: Define and call a new function Declare a function called printIntroductions The function should accept an NSString as a parameter called name Cut and paste the introduction and japaneseIntroduction code inside of the new function You should have errors for referencing 'myName'. Change any reference to 'myName' to 'name'. This is an error of scope. You only declared 'myName' in your didFinishLaunching method. Not in your new method. In your new method, you declared an argument called 'name' that your function accepts when the method is called In your didFinishLaunching method after you set myName call printIntroductions: and pass in 'myName' as an argument It should print out the introduction and Japanese introduction Step 4: Recurse through a function Add a new function called countDownTillIntroduction: that accepts an integer called numberOfDays as an argument The function should do the following: Check to see if the numberOfDays is 0 If the number of days is 0, it should print "The time has come" If numberOfDays is not 0 It should print "[numberOfDays] days left until introductions" It should declare and set a variable oneLessDay and set it to numberOfDays - 1 It should then call countDownTillIntroduction and pass in oneLessDay In the didFinishLaunching method before you call printIntroductions call countDownTillIntroduction and pass in 4 Completion: OUTPUT: You should see it print "4 days left until introductions", "3 days left until introductions" (down to 1) and then it should print "The time has come" and "My name is [yourName]", "[yourName] to moushimasu"

          P Offline
          P Offline
          Peter Webb
          wrote on last edited by
          #4

          I think almost everybody reading a discussion board on Objective-C would be able to "solve this project". Do you have any other questions?

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups