class Violin {
String[] ViolinStrings = {"E", "A", "D", "G"};
boolean ViolinTuned = false;
boolean ViolinPlaying = false;
boolean ViolinMusician = false;
boolean ViolinStopPlaying = false;
public Violin() {
}
public void VTuned() {
ViolinTuned = true;
System.out.println("The violins are now tuned.");
}
public void VPlaying() {
ViolinPlaying = true;
System.out.println("The violins are now playing.");
}
public void VMusician() {
ViolinMusician = true;
System.out.println("The violin musicians are ready to play.");
}
public void VStopPlaying() {
ViolinStopPlaying = true;
System.out.println("The violins have stopped playing.");
}
}
class Viola {
String[] ViolaStrings = {"C", "G", "D", "A"};
boolean ViolaTuned = false;
boolean ViolaPlaying = false;
boolean ViolaMusician = false;
boolean ViolaStopPlaying = false;
public Viola() {
}
public void ViolaTuned() {
ViolaTuned = true;
System.out.println("The violas are now tuned.");
}
public void ViolaPlaying() {
ViolaPlaying = true;
System.out.println("The violas are now playing.");
}
public void ViolaMusician() {
ViolaMusician = true;
System.out.println("The viola musicians are ready to play.");
}
public void ViolaStopPlaying() {
ViolaStopPlaying = true;
System.out.println("The violas have stopped playing.");
}
}
class Cello {
String[] CelloStrings = {"C", "G", "D", "A"};
boolean CelloTuned = false;
boolean CelloPlaying = false;
boolean CelloMusician = false;
boolean CelloStopPlaying = false;
public Cello() {
}
public void CelloTuned() {
CelloTuned = true;
System.out.println("The Cellos are now tuned.");
}
public void CelloPlaying() {
CelloPlaying = true;
System.out.println("The Cellos are now playing.");
}
public void CelloMusician() {
CelloMusician = true;
System.out.println("The Cello musicians are ready to play.");
}
public void CelloStopPlaying() {
CelloStopPlaying = true;
System.out.println("The Cellos have stopped playing.");
}
}
class Bass {
String[] BassStrings = {"E", "A", "D", "G"};
boolean BassTuned = false;
boolean BassPlaying = false;
boolean BassMusician = false;
boolean BassStopPlaying = false;
public Bass() {
}
public void BassTuned() {
BassTuned = true;
System.out.println("The Bass guitars are now tuned.");
}
public void BassPlaying() {
BassPlaying = true;
System.out.println("The Bass guitars are now playing.");
}
public void BassMusician() {
BassMusician = true;
System.out.println("The Bass musicians are ready to play.");
}
public void BassStopPlaying() {
BassStopPlaying = true;
System.out.println("The Bass guitars have stopped playing.");
}
}
public class ArrayandClass2 {
public static void man(String[] args) {
Violin Violin1 = new Violin();
Viola Viola1 = new Viola();
Cello Cello1 = new Cello();
Bass Bass1 = new Bass();
Violin1.VTuned();
Violin1.VPlaying();
Violin1.VMusician();
Viola1.ViolaTuned();
Viola1.ViolaPlaying();
Viola1.ViolaMusician();
Cello1.CelloTuned();
Cello1.CelloPlaying();
Cello1.CelloMusician();
Bass1.BassTuned();
Bass1.BassPlaying();
Bass1.BassMusician();
}
}
Need help with methods in classes. Compiling but not running properly.
Started by D-COD3R, Apr 06 2011 06:03 PM
2 replies to this topic
#1
Posted 06 April 2011 - 06:03 PM
I am having an issue with this program. Its not displaying the statements in the methods within each class. Such as "The violins are not tuned". The program however is compiling correctly. What seems to be my issue.
|
|
|
#2
Posted 07 April 2011 - 09:26 AM
You have public static void man instead of main maybe?
#3
Posted 10 April 2011 - 06:58 AM
this program should be run and print those statement
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









