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

class Contact
{
    string Name;
    string Address;
    string Email;
    string PhoneNo;
    public void AddContact()
    { 
    Console.WriteLine("Enter contact name");
    Name = Console.ReadLine();
    Console.WriteLine("Enter contact Address");
    Address = Console.ReadLine();
    Console.WriteLine("Enter contact Email");
    Email = Console.ReadLine();
    Console.WriteLine("Enter contact PhoneNo");
    PhoneNo = Console.ReadLine();
    }
    public void DisplayContact()
    {
        Console.WriteLine("Name");
        Console.WriteLine("Address");
        Console.WriteLine("Email");
        Console.WriteLine("PhoneNo");

    }
    class Details
    {

   public void Main(string[] args)
    {
        Contact contact1 = New contact();
        contact1.AddContact();
        contact1.DisplayContact();



    }
}

Recommended Answers

All 6 Replies

Whats the problem with this?

Were you asking a question, or protesting proper use of OO design?

You haven't closed off the Contact class before defining the Details class.

You should take unnecessary white spaces out to make it more readable (but not so it's one continuous word)

How do i make any contact i add go into another file permenently?

What is it you want to do ?

What file type do you want to save the contact to ?

How do you want it formatting ?

Other than the above (which has nothing to do with saving contacts to another file) what code do you have to show your attempt ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.