repl.it
@janimanthan80/

Task1.java

Java

No description

fork
loading
Files
  • Main.java
  • jdt.ls-java-project
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
public class task3 {
 
    public static void main(String[] args) throws Exception{ 
class Violin   
 {  
     boolean isTuned;  
     boolean isPlaying;   
         
     //array for Violin strings  
     char [] violinStrings = {'E','A','D','G'};  
         
     //default Violin object  
     public Violin()  
     {  
         isTuned = false;  
         isPlaying = false;  
         System.out.println("The violin is not playing, and it is not tuned.");  
     }  
         
     public Violin(boolean T, boolean P)  
     {  
         isTuned = T;  
         isPlaying = P;  
     }  
         
     public boolean playViolin()  
     {  
        System.out.println("The violin is playing!");  
        return isPlaying = true;  
     }  
         
     public boolean stopPlaying()  
     {  
         System.out.println("The violin has stopped playing.");  
         return isPlaying = false;  
     }  
         
     public boolean tuneViolin()  
     {  
         System.out.println("The violin is being tuned!");  
         return isTuned = true;  
     }  
         
 }  
    
}  
class Trumpet   
 {  
     boolean isTuned; 
     boolean isPlaying; 
         
     //array for trumpet strings  
     char [] TrumpetStrings = {'Q','E','M','P'};  
         
     //default trumpet object  
     public Violin()  
     {  
         isTuned = false;  
         isPlaying = false;  
         System.out.println("The trumpet is not playing, and it is not tuned.");  
     }  
         
     public Trumpet(boolean T, boolean P)  
     {  
         isTuned = T;  
         isPlaying = P;  
     }  
         
     public boolean playTrumpet()  
     {  
        System.out.println("The trumpet is playing!");  
        return isPlaying = true;  
     }  
         
     public boolean stopPlaying()  
     {  
         System.out.println("The trumpet has stopped playing.");  
         return isPlaying = false;  
     }  
         
     public boolean tuneTrumpet()  
     {  
         System.out.println("The trumpet is being tuned!");  
         return isTuned = true;  
     }  
         
 }  
    
}