CelticPaint
CelticPaint

Reputation: 1

In C# 1st very new to coding This is for a College class. I have created as instructed BUT GetName and SetName show as NO method?

Code should get user to input first & last name.

using System;

namespace CSCI_231_Week3_Assn_8
{
    class AccountTest
    {
       static void Main()
       {
          // Create an Account object and assign it to myAccount
          AccountTest myAccount = new AccountTest();

          // Display myAccount's initial name
          Console.WriteLine($"Initial name is: {myAccount.GetName()}");
          // Prompt for and read the name (First & Last) then put the name in the object
          Console.Write("Enter your First & Last name: "); // Propts user to enter their first & last 
          name
          string userName = Console.ReadLine(); // Reads the first & last name entered by user
          myAccount.SetName(userName); // put userName in the myAccount object

          // Display the name stored in the myAccount object
          Console.WriteLine($"myAccount's name is: {myAccount.GetName()}");
       }
    }
 }

So I have missed something but am lost as to what?

Upvotes: -1

Views: 96

Answers (1)

Christopher Painter
Christopher Painter

Reputation: 55601

This code sample isn't complete. It doesn't show the implementation of the SetName and GetName methods.

Upvotes: 0

Related Questions