Question: Using C# Fill in the stubbed out class file that is included in the assignment, make sure you comment the code accordingly and complete all
Using C#
Fill in the stubbed out class file that is included in the assignment, make sure you comment the code accordingly and complete all of the methods that are not implemented.
Write a class for an address called Address.cs it should have properties for the following things, First Name, Last Name, Address Line One, Address Line Two, City, State, Zip, Birthday, Phone Number. You must implement the IComparable interface and add the appropriate overrides for an object in c#. Your IComparable interface should make it so all address are sorted by LastName then FirstName and finally by the Zip code (this means if the LastName are the same then we Compare FirstNames and if they are the same the Zip code is the tie breaker). When the address is printed out it should be in the following format.
FirstName LastName
Address Line One
Address Line Two
City, State Zip
Phone Number
Here is the what is provided so far:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;
namespace Warmup {
public class Address : IComparable
{ public Address(string firstName = null, string lastName = null, string lineOne = null, string lineTwo = null, string city = null, string state = null, int zipCode = 0, DateTime birthDate = default(DateTime), string phoneNumber = null) { FirstName = firstName; LastName = lastName; LineOne = lineOne; LineTwo = lineTwo; City = city; State = state; ZipCode = zipCode; BirthDate = birthDate; PhoneNumber = phoneNumber; }public string FirstName { get; set; } public string LastName { get; set; } public string LineOne { get; set; } public string LineTwo { get; set; } public string City { get; set; } public string State { get; set; } public int ZipCode { get; set; } public DateTime BirthDate { get; set; } public string PhoneNumber { get; set; }
public override string ToString() { throw new NotImplementedException(); }
public override bool Equals(object obj) { throw new NotImplementedException(); } public override int GetHashCode() { return base.GetHashCode(); }
public int CompareTo(Address other) { throw new NotImplementedException(); }
} }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
