Sunday, 8 September 2013

C# Namespace definition error, End of file expected. Also, expected class enum, delegate or struct

C# Namespace definition error, End of file expected. Also, expected class
enum, delegate or struct

Alright, so I'm working on this assignment and I can't figure out why it's
giving me this error.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Account
{
class Checking //Personal class implemented for the account holder.
{
//Checking class Variables.
private string m_name;
private double m_currBalance;
private int m_pin;
private bool m_status;
private bool m_accountLocked;
//Open function.
public void open()
{
string input = null;
Checking check1 = new Checking();
Console.WriteLine("Please enter your name: ");
input = Console.ReadLine();
m_name = input;
Console.WriteLine("Please enter your balance: ");
input = Console.ReadLine();
m_currBalance = double.Parse(input);
}
//Inquire function.
public void inquire()
{
Console.WriteLine(m_name);
Console.WriteLine (m_currBalance);
}
//Depost function.
public void deposit()
{
string input = null;
Console.WriteLine(m_name);
Console.WriteLine("Deposit: $");
input = Console.ReadLine();
m_currBalance += double.Parse(input);
}
//Withdraw function.
public void withdraw()
{
string input = null;
Console.WriteLine(m_name);
Console.WriteLine("Withdraw: ");
input = Console.ReadLine();
m_currBalance -= double.Parse(input);
}
}
class Program
{
public static void customerMenu()
{
string cust_Choice = null;
Checking check1 = new Checking();
do
{
Console.WriteLine("[I]nquire [D]eposit [W]ithdraw: ");
cust_Choice = Console.ReadLine();
cust_Choice = cust_Choice.ToUpper();
//Switch statement for customer
switch (cust_Choice)
{
case "I": //Inquire on cust account
check1.inquire();
break;
case "D":
check1.deposit();
break;
case "W":
check1.withdraw();
break;
default:
break;
}
}while(cust_Choice != "Q");
}
}
public static void Main(string[] args)//right here is the
delegate enum error.
{
//Input variable from the user.
string choice = null;
Checking check = new Checking();
do
{
Console.Write("[O]pen Account [I]nquire [D]eposit
[W]ithdraw [Q]uit: ");
choice = Console.ReadLine();
choice = choice.ToUpper();
switch (choice)
{
case "O": // open an account
check1.open();
break;
case "I": // inquire about the account
check1.inquire();
break;
case "D": // deposit into the account
check1.deposit();
break;
case "W": // withdraw from the account
check1.withdraw();
break;
default:
break;
}
} while (choice != "Q");
}
}//eof error
I really don't quite understand why it's giving me an EOF error and
namespace error nor do i understand why i can't access the object in
another class. If someone could just explain it to me i could fix or or
tell me if I'm missing a curly brace or something. I could be done with
this assignment now if not for this stupid bug. I'm sure it's something
really simple that I have just forgotten or as soon as I'm done posting
this I'll see it. But, any help is appreciated. Thanks in advance.

No comments:

Post a Comment