Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6569661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:39:35+00:00 2026-05-25T14:39:35+00:00

currently I am studying in Sweden an online course Fundamental programming in C# and

  • 0

currently I am studying in Sweden an online course Fundamental programming in C# and I have a problem with one of the examples. In the lecture there is an example of Methods and parameters and there is a mistake in the coding so when I want to try it and see what it does it doesn’t work. I have written an email to the lecturer couple of days ago but he is not responding.

Here is the code:
I have two classes. First is Account.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Classes_Objects_2
{
    class Account
    {
        public double Balance = 0;

        public void ShowMessage()
        {
            Console.WriteLine("Welcome to the Account Book!");
        }

        // Method Deposit.
        public double Deposit(double depositAmount)
        {
            // You get a 5% bonus.
            return depositAmount * 1.05;
        }
    }
}

And here is the second code which returns 2 errors:

Class is called Accounts.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Classes_Objects_2
{
    class Accounts
    {
        static void Main(string[] args)
        {
            Account myAccount = new Account();
            myAccount.ShowMessage();
            Console.WriteLine("Your balance is " + myAccount.Balance);
            Console.Write("Enter the deposit amount: ");
            double newBalance = myAccount.Deposit(double.Parse(Console.ReadLine()));
            newBalance = amountDep;
            Console.WriteLine("Your balance becomes " + newBalance);
            Console.Write("Enter the next deposit amount: ");
            newBalance = myAccount.Deposit(double.Parse(Console.ReadLine()));
            newBalance = amountDep;
            Console.WriteLine("Your balance becomes " + newBalance);
        }
    }
}

When user enters 100 as deposit, he gets 105 with the deposit and then when he enters 200 he gets 315. That is output I am aiming for and it should work according to the lecture.

I get error in the Accounts class because of the amountDep, it ssays it is not recognized, which is true but I have no idea how to fix this. Can you please help me figure this one out so I can continue studying?
Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T14:39:36+00:00Added an answer on May 25, 2026 at 2:39 pm

    You need to change your Deposit method to include “Balance += depositAmount * 1.05” to increment the account balance and store the deposit. Use the Balance field of your account class to retrieve the current balance in your Main method (e.g. Console.WriteLine(“Balance: ” + myAccount.Balance);
    Notes: You should not use public fields, but class properties. Fields should not be named in upper case (like “Balance”), but “balance”, or “_balance”, or “mBalance”.
    Good luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently studying programming and I have the following problem. A user should
I am currently studying recursion in school, and I have trouble thinking about methods
Hi i am currently studying sql and I have 2 one to many tables
I'm currently studying socket programming, i'm working on creating an application to use my
I'm currently studying the malloc implementation for my homework. I know there exists some
I am currently studying for an exam I'll have on x86 assembly. I didn't
I'm currently studying for a CS course's final exam and I've run into a
I'm currently self-studying C for mastering an university project. In that project we have
I am currently studying SQLite and I have found that it uses various classes
currently i'm studying MySQL, sorry for my newbie question. Here my question I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.