Design and implement a stringed musical instrument class using the following guidelines:
a. Data fields for your instrument should include number of strings, variables for string names (e.g. E, A, D, G), and boolean fields to determine if the instrument is tuned, and if the instrument is currently playing. You are welcome to add additional data fields if you like.
b. A constructor method that set the tuned and currently playing fields to false.
c. Other methods 1) to tune the instrument, 2) to start the instrument playing, and 3) to stop the instrument from playing.
d. Other methods as you see fit (Add at least one unique method).
I have the following code. I think my problem is that i have a class within a class and I have not declared it correctly. Please Help! Thanks in advance!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
class Guitar
{
bool isTuned; //Guitar starts off not tuned
bool isPlaying; //Guitar is not playing at start
//array for Guitar strings
char [] GuitarStrings = {'E','A','D','G'};
//default Guitar object
public Guitar()
{
isTuned = false;
isPlaying = false;
Console.Write("The Guitar is not playing, and it is not tuned.");
}
public Guitar(bool T, bool P)
{
isTuned = T;
isPlaying = P;
}
public bool playGuitar()
{
Console.Write("The Guitar is playing!");
return isPlaying = true;
}
public bool stopPlaying()
{
Console.Write("The Guitar has stopped playing.");
return isPlaying = false;
}
public bool tuneGuitar()
{
Console.Write("The Guitar is being tuned!");
return isTuned = true;
System.Console.WriteLine("Hit Enter to continue");
System.Console.ReadLine();
}
}
}
}