EDN Admin
Well-known member
<p style="line-height:normal <span style="font-size:12.0pt; font-family:Times New Roman,serif This project focuses on demonstrating your understanding of classes and objects. Before attempting this project, be sure you have completed all of the reading
assignments listed in the syllabus to date, participated in the weekly conferences, and thoroughly understand the examples throughout the chapters. The project requirements include:
<p style="text-indent:-.25in <span style="font-size:12.0pt; line-height:115%; font-family:Times New Roman,serif 1. Design and implement a stringed musical instrument class using the following guidelines:
<ol>
<span style="font-size:7.0pt; line-height:115%; font-family:Times New Roman,serif
<span style="font-size:12.0pt; line-height:115%; font-family:Times New Roman,serif 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.<span style="font-size:7.0pt; line-height:115%; font-family:Times New Roman,serif
<span style="font-size:12.0pt; line-height:115%; font-family:Times New Roman,serif A constructor method that set the tuned and currently playing fields to false.<span style="font-size:7.0pt; line-height:115%; font-family:Times New Roman,serif
<span style="font-size:12.0pt; line-height:115%; font-family:Times New Roman,serif Other methods 1) to tune the instrument, 2) to start the instrument playing, and 3) to stop the instrument from playing.<span style="font-size:7.0pt; line-height:115%; font-family:Times New Roman,serif
<span style="font-size:12.0pt; line-height:115%; font-family:Times New Roman,serif Other methods as you see fit (Add at least one unique method).</ol>
<p style="text-indent:-.25in <span style="font-size:12.0pt; line-height:115%; font-family:Times New Roman,serif 2. 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.
<p style="text-indent:-.25in <span style="font-size:12.0pt; line-height:115%; font-family:Times New Roman,serif 3. 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. For example:
<p style=" <span style="font-size:12.0pt; font-family:Times New Roman,serif public void playviolin() { Console.WriteLine("The violin is now playing.");
}
<p style="text-indent:-.25in <span style="font-size:12.0pt; line-height:115%; font-family:Times New Roman,serif 4. Finally, create a C# test class that simulates using your instrument class. In your test class
be you should at a minimum: a) Construct 10 instances of your instrument, b) tune your instruments, c) Start playing your instrument, d) Call your unique method, and e) Stop playing your instruments. (Hint: Arrays and Loops will make your job easier
and result in more efficient code!)
<p style="text-indent:-.25in <span style="font-size:12.0pt; line-height:115%; font-family:Times New Roman,serif 5. Your programs should compile and run without errors.
<p style="text-indent:-.25in <span style="font-size:12.0pt; line-height:115%; font-family:Times New Roman,serif 6. Be sure to test your program carefully. Provide a list of comprehensive test cases used to validate your
application and include these test cases in your word document containing your UML class diagram and descriptions. Similar to Project 1, your test data can be shown in a table that includes input data, expected output, actual output and pass/fail results from
the test.
THIS IS WHAT I HAVE SO FAR...
using System;<br/>
using System.Collections.Generic;<br/>
using System.Linq;<br/>
using System.Text;<br/>
<br/>
<br/>
namespace StringedMusicalApp<br/>
{<br/>
<br/>
public class Program<br/>
{<br/>
public static void Main()<br/>
{<br/>
//Variable to store the nanme of violin<br/>
private String nameValue;<br/>
//Variable to store number of strings<br/>
private int numberOfStringsValue;<br/>
private char[] stringsValue = { E, A, D, G };<br/>
//fields to determine if the instrument is tuned,<br/>
private bool tunedValue;<br/>
//and if the instrument is currently playing.<br/>
private bool playingValue;<br/>
//A constructor method that set the tuned and currently playing fields to false.<br/>
public Program()<br/>
{<br/>
this.tunedValue = false;<br/>
this.playingValue = false;<br/>
}<br/>
// getter an setter methods<br/>
public String Name<br/>
{<br/>
get<br/>
{<br/>
return nameValue;<br/>
}<br/>
set<br/>
{<br/>
nameValue = value;<br/>
}<br/>
}<br/>
public int NumberOfStrings<br/>
{<br/>
get<br/>
{<br/>
return numberOfStringsValue;<br/>
}<br/>
set<br/>
{<br/>
numberOfStringsValue = value;<br/>
}<br/>
}<br/>
public void DisplayStringValues()<br/>
{<br/>
Console.WriteLine("String Values: ");<br/>
for (int i = 0; i < stringsValue.Length; i++)<br/>
{<br/>
Console.Write(stringsValue + " ");<br/>
}<br/>
Console.WriteLine();<br/>
}<br/>
<br/>
public bool Tuned<br/>
{<br/>
get<br/>
{<br/>
return tunedValue;<br/>
}<br/>
set<br/>
{<br/>
tunedValue = value;<br/>
}<br/>
}<br/>
public bool Playing<br/>
{<br/>
get<br/>
{<br/>
return playingValue;<br/>
}<br/>
set<br/>
{<br/>
playingValue = value;<br/>
}<br/>
}<br/>
//Method to play the violin<br/>
public void playViolin()<br/>
{<br/>
Console.WriteLine("The violin is now playing.");<br/>
Playing = true;<br/>
}<br/>
//Method to sto playing the violin<br/>
public void stopViolin()<br/>
{<br/>
Console.WriteLine("The violin has stopped playing.");<br/>
Playing = false;<br/>
}<br/>
//Method to tune the violin<br/>
public void tuneViolin()<br/>
{<br/>
Console.WriteLine("The violin is tuned.");<br/>
Tuned = true;<br/>
}<br/>
//Method to stop tuning the violin<br/>
public void stopTuneViolin()<br/>
{<br/>
Console.WriteLine("The violin has stopped tuning.");<br/>
Tuned = false;<br/>
}<br/>
}<br/>
}<br/>
I keep getting errors but I cant figure out what wrong.
Thanks in advance for your help
View the full article
assignments listed in the syllabus to date, participated in the weekly conferences, and thoroughly understand the examples throughout the chapters. The project requirements include:
<p style="text-indent:-.25in <span style="font-size:12.0pt; line-height:115%; font-family:Times New Roman,serif 1. Design and implement a stringed musical instrument class using the following guidelines:
<ol>
<span style="font-size:7.0pt; line-height:115%; font-family:Times New Roman,serif
<span style="font-size:12.0pt; line-height:115%; font-family:Times New Roman,serif 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.<span style="font-size:7.0pt; line-height:115%; font-family:Times New Roman,serif
<span style="font-size:12.0pt; line-height:115%; font-family:Times New Roman,serif A constructor method that set the tuned and currently playing fields to false.<span style="font-size:7.0pt; line-height:115%; font-family:Times New Roman,serif
<span style="font-size:12.0pt; line-height:115%; font-family:Times New Roman,serif Other methods 1) to tune the instrument, 2) to start the instrument playing, and 3) to stop the instrument from playing.<span style="font-size:7.0pt; line-height:115%; font-family:Times New Roman,serif
<span style="font-size:12.0pt; line-height:115%; font-family:Times New Roman,serif Other methods as you see fit (Add at least one unique method).</ol>
<p style="text-indent:-.25in <span style="font-size:12.0pt; line-height:115%; font-family:Times New Roman,serif 2. 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.
<p style="text-indent:-.25in <span style="font-size:12.0pt; line-height:115%; font-family:Times New Roman,serif 3. 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. For example:
<p style=" <span style="font-size:12.0pt; font-family:Times New Roman,serif public void playviolin() { Console.WriteLine("The violin is now playing.");
}
<p style="text-indent:-.25in <span style="font-size:12.0pt; line-height:115%; font-family:Times New Roman,serif 4. Finally, create a C# test class that simulates using your instrument class. In your test class
be you should at a minimum: a) Construct 10 instances of your instrument, b) tune your instruments, c) Start playing your instrument, d) Call your unique method, and e) Stop playing your instruments. (Hint: Arrays and Loops will make your job easier
and result in more efficient code!)
<p style="text-indent:-.25in <span style="font-size:12.0pt; line-height:115%; font-family:Times New Roman,serif 5. Your programs should compile and run without errors.
<p style="text-indent:-.25in <span style="font-size:12.0pt; line-height:115%; font-family:Times New Roman,serif 6. Be sure to test your program carefully. Provide a list of comprehensive test cases used to validate your
application and include these test cases in your word document containing your UML class diagram and descriptions. Similar to Project 1, your test data can be shown in a table that includes input data, expected output, actual output and pass/fail results from
the test.
THIS IS WHAT I HAVE SO FAR...
using System;<br/>
using System.Collections.Generic;<br/>
using System.Linq;<br/>
using System.Text;<br/>
<br/>
<br/>
namespace StringedMusicalApp<br/>
{<br/>
<br/>
public class Program<br/>
{<br/>
public static void Main()<br/>
{<br/>
//Variable to store the nanme of violin<br/>
private String nameValue;<br/>
//Variable to store number of strings<br/>
private int numberOfStringsValue;<br/>
private char[] stringsValue = { E, A, D, G };<br/>
//fields to determine if the instrument is tuned,<br/>
private bool tunedValue;<br/>
//and if the instrument is currently playing.<br/>
private bool playingValue;<br/>
//A constructor method that set the tuned and currently playing fields to false.<br/>
public Program()<br/>
{<br/>
this.tunedValue = false;<br/>
this.playingValue = false;<br/>
}<br/>
// getter an setter methods<br/>
public String Name<br/>
{<br/>
get<br/>
{<br/>
return nameValue;<br/>
}<br/>
set<br/>
{<br/>
nameValue = value;<br/>
}<br/>
}<br/>
public int NumberOfStrings<br/>
{<br/>
get<br/>
{<br/>
return numberOfStringsValue;<br/>
}<br/>
set<br/>
{<br/>
numberOfStringsValue = value;<br/>
}<br/>
}<br/>
public void DisplayStringValues()<br/>
{<br/>
Console.WriteLine("String Values: ");<br/>
for (int i = 0; i < stringsValue.Length; i++)<br/>
{<br/>
Console.Write(stringsValue + " ");<br/>
}<br/>
Console.WriteLine();<br/>
}<br/>
<br/>
public bool Tuned<br/>
{<br/>
get<br/>
{<br/>
return tunedValue;<br/>
}<br/>
set<br/>
{<br/>
tunedValue = value;<br/>
}<br/>
}<br/>
public bool Playing<br/>
{<br/>
get<br/>
{<br/>
return playingValue;<br/>
}<br/>
set<br/>
{<br/>
playingValue = value;<br/>
}<br/>
}<br/>
//Method to play the violin<br/>
public void playViolin()<br/>
{<br/>
Console.WriteLine("The violin is now playing.");<br/>
Playing = true;<br/>
}<br/>
//Method to sto playing the violin<br/>
public void stopViolin()<br/>
{<br/>
Console.WriteLine("The violin has stopped playing.");<br/>
Playing = false;<br/>
}<br/>
//Method to tune the violin<br/>
public void tuneViolin()<br/>
{<br/>
Console.WriteLine("The violin is tuned.");<br/>
Tuned = true;<br/>
}<br/>
//Method to stop tuning the violin<br/>
public void stopTuneViolin()<br/>
{<br/>
Console.WriteLine("The violin has stopped tuning.");<br/>
Tuned = false;<br/>
}<br/>
}<br/>
}<br/>
I keep getting errors but I cant figure out what wrong.
Thanks in advance for your help
View the full article