Im in school and need help with my coding. Teacher is no help so was hoping some one can correct my code. I'm trying to develop a simple inheritance hierarchy that has an abstract base class that includes an abstract method.
Abtract Class:
Code the abstract base class called MusicPlayer that has the abstract method: Play( ). Include at least two state variables that are appropriate to the abstract base class and define accessor/mutator methods or properties for every state variable included in the class.
Derived class:
Complete the abstraction for the iPod class and code it.
Main Method:
Code a Main method to test the Play( ) method in the derived class.
My Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
public abstract class MusicPlayer
{
protected string manufacture;
protected bool price;
public string Manufacture
{
get { return manufacture; }
set { manufacture = value; }
}
public bool Price
{
get { return price; }
set { price = value; }
}
public abstract void Play();
}
public class IPod : MusicPlayer
{
private string color;
private string video;
public Color()
{
manufacture = "Apple iPod";
price = "On sale";
color = "Black";
video = "Plays movies";
}
public override void Manufacture()
{
Console.WriteLine("The"+ this.manufacture+ "30Gig" + this.price+ "is on sale"+ this.color+ "black"+ this.video );
}
~IPod(){}
public class Test
{
static void Main(string[ ] args)
{
IPod myIpod = new Ipod();
myIPod.Manufacture = "Apple iPod";
myIPod.Price = "On sale";
myIPod.Color = "Black";
myIPod.Video = "Plays movies";
myIPod.Musicplayer();
Console.ReadLine();
}
}
}
}