Question: using System; namespace CNIT155Lab4 { class Program { static void Main(string[] args) { Account myAccount = new Account(); Console.WriteLine($no name is: {myAccount.GetName()}); Console.Write(Please enter a
using System;
namespace CNIT155Lab4 { class Program { static void Main(string[] args) { Account myAccount = new Account(); Console.WriteLine($"no name is: {myAccount.GetName()}"); Console.Write("Please enter a name: "); string theName = Console.ReadLine(); myAccount.SetName(theName); Console.Write("The new name is: "); Console.WriteLine($" {myAccount.GetName()}");
Console.WriteLine($" Initial Balance is {myAccount.Balance:C}"); Console.Write("Please enter a deposit: "); decimal dcmDeposit = decimal.Parse(Console.ReadLine()); myAccount.MakeDeposit(dcmDeposit); Console.WriteLine($"Now the balance is {myAccount.Balance:C}"); } } }
using System; using System.Collections.Generic; using System.Text;
namespace CNIT155Lab4 { class Account { private string name;
public decimal Balance { get; private set; }
public void SetName(string accountName) { name = accountName; } public string GetName() { return name; } public void Deposit(decimal depositAmount) { if(depositAmount > 0.0m) { Balance += depositAmount; } }
internal void MakeDeposit(decimal dcmDeposit) { throw new NotImplementedException(); } } }
I cannot get this program to work. It keeps saying args is an unused parameters and same for dcm deposit. I got it to work a few times but it does not show the ending balance when you type everything in.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
