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. C#
  4. What the heck does this mean? [modified]

What the heck does this mean? [modified]

Scheduled Pinned Locked Moved C#
question
3 Posts 3 Posters 0 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.
  • N Offline
    N Offline
    Nathan Revka
    wrote on last edited by
    #1

    This might just be poor wording on part of the writer, but what does this mean: "Each object of the class contains a private instance variable savingsBalance, indicating the amount the saver has on deposit along with the account holder's first and last names." Is the private instance variable this:

    static private object savingsBalance = firstName + " " + lastName + "has $" + amount;

    And what does "each object of the class" mean? Isn't every single keyword an object? Edit: He wants me to calculate stuff with savingsBalance but I do not think I am able to do that with an object that includes a string with a word like "has"

    modified on Sunday, August 2, 2009 5:44 PM

    Richard Andrew x64R C 2 Replies Last reply
    0
    • N Nathan Revka

      This might just be poor wording on part of the writer, but what does this mean: "Each object of the class contains a private instance variable savingsBalance, indicating the amount the saver has on deposit along with the account holder's first and last names." Is the private instance variable this:

      static private object savingsBalance = firstName + " " + lastName + "has $" + amount;

      And what does "each object of the class" mean? Isn't every single keyword an object? Edit: He wants me to calculate stuff with savingsBalance but I do not think I am able to do that with an object that includes a string with a word like "has"

      modified on Sunday, August 2, 2009 5:44 PM

      Richard Andrew x64R Offline
      Richard Andrew x64R Offline
      Richard Andrew x64
      wrote on last edited by
      #2

      I think he means "each instance of the class". But that's just a guess. And the fact that he said it was a private instance variable means it is NOT a static.

      1 Reply Last reply
      0
      • N Nathan Revka

        This might just be poor wording on part of the writer, but what does this mean: "Each object of the class contains a private instance variable savingsBalance, indicating the amount the saver has on deposit along with the account holder's first and last names." Is the private instance variable this:

        static private object savingsBalance = firstName + " " + lastName + "has $" + amount;

        And what does "each object of the class" mean? Isn't every single keyword an object? Edit: He wants me to calculate stuff with savingsBalance but I do not think I am able to do that with an object that includes a string with a word like "has"

        modified on Sunday, August 2, 2009 5:44 PM

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #3

        Nathan Revka wrote:

        He wants me to calculate stuff with savingsBalance but I do not think I am able to do that with an object that includes a string

        This makes your teacher a bit dumb, IMO, but you can convert a string into a number using decimal.TryParse, or int.TryParse, depending on what type you want. You can also use the decimal.Parse or even Convert.ToInt32, etc, but the tryparse will not blow up if the string does not contain a number. Of course, if amount is a number, then that's all you would use to calculate with. Storing the savingsBalance as a string, seems odd to me, the balance is the number, the rest is the account name. The string might be rendered by a helper method, but surely amount is also being stored somewhere ?

        Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

        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