Это мое назначение:Метод должен объявить тело?
Design and implement a stringed musical instrument class using the following guidelines:
Data fields for your instrument should include number of strings, an array of string names representing 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.
A constructor method that set the tuned and currently playing fields to false. Other methods
- to tune the instrument,
- to start the instrument playing, and
- to stop the instrument from playing.
Other methods as you see fit (add at least one unique method).
Create a UML class diagram using a diagram tool (e.g. PPT, Visio) of your choice. Prepare the diagrams and place them in a Word document along with a brief description of your class.
Create a C# class for your instrument. Be sure that your code matches your design specifications and some minimal functionality is included. For example, if you called the violin.play() method, you should at least print that the violin is playing. Similar functionality should be supplied when you stop playing, tune or call any of your methods.
Мой код до сих пор:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace StringedMusInsApp
{
public class Guitarra
{
public static void Main (string[] args);
//variable that stores the guitarra's name
private String nameValue;
//variable to store strings
private int numberOfStringsValue;
private char[] stringsValue = { 'E', 'A', 'D', 'G', 'B', 'E' };
//field for tune of the guitar,
private bool tunedValue;
//field for playing of guitar
private bool playingValue;
//method to set tune and playing false.
public Guitarra()
{
this.tunedValue = false;
this.playingValue = false;
}
// gets and sets
public String Name
{
get
{
return nameValue;
}
set
{
nameValue = value;
}
}
public int NumberOfStrings
{
get
{
return numberOfStringsValue;
}
set
{
numberOfStringsValue = value;
}
}
public void DisplayStringValues()
{
Console.WriteLine("String Values: ");
for (int i = 0; i < stringsValue.Length; i++)
{
Console.Write(stringsValue[i] + " ");
}
Console.WriteLine();
}
public bool Tuned
{
get
{
return tunedValue;
}
set
{
tunedValue = value;
}
}
public bool Playing
{
get
{
return playingValue;
}
set
{
playingValue = value;
}
}
//Method to play the violin
public void playGuitar()
{
Console.WriteLine("The guitar is now playing.");
Playing = true;
}
//Method to sto playing the violin
public void stopGuitar()
{
Console.WriteLine("The guitar has stopped playing.");
Playing = false;
}
//Method to tune the Guitar
public void tuneGuitar()
{
Console.WriteLine("The guitar is tuned.");
Tuned = true;
}
//Method to stop tuning the Guitar
public void stopTuneGuitar()
{
Console.WriteLine("The guitar has stopped tuning.");
Tuned = false;
}
}
}
Но я получаю эту ошибку:
Error 1 'StringedMusInsApp.Guitarra.Main(string[])' must declare a body because it is not marked abstract, extern, or partial.
И какова будет ошибка? – Lloyd
Ошибка 1 'StringedMusInsApp.Guitarra.Main (string [])' должен объявить тело, потому что оно не отмечено абстрактным, внешним или частичным. –
Я смотрел онлайн часами и не мог понять, что я делаю неправильно –