logow

Java Program for Musical Instruments System with simple code and output

Java Program For Musical Instruments


Program Explanation::::::

  • First we create a class name Musicians that's contains three methods string() , wind() and perc().
  • In string method we create a String (String is a array of characters) str1 and initialize with containing details and we know in array program we need a for loop to print array details as well as for String we take a for loop . int i declare to initialize for loop.
  • In wind method we create a String (String is a array of characters) str2 and initialize with containing details and we know in array program we need a for loop to print array details as well as for String we take a for loop . 
  • In perc method we create a String (String is a array of characters) str3 and initialize with containing details and we know in array program we need a for loop to print array details as well as for String we take a for loop . 
  • In second class we create TypeInsto and extends Musicians using Inheritance oops concepts that's derived all properties of Musicians class.
  • Inside the TypeInsto we use Scanner class to take input from user and declare variable int choice  to save user operation choice and it's use in switch case .
  • We also declare get() method that's use for display user operation's on console such as choose your operation to perform and user press input according to their use. get() method's body saved with int choice variable.
  • Again we create one more class name show() that's use for perform operation's display on user's choice.we use switch case to control the flow of execution.If user press wrong key then default case will be executed.
  • Finally we create a main method class name instruments and create a object with the derived class TypeInsto .
  • In this class we declare int t for create Yes or No choice using do-while loop.
  • After that we create a object TypeInsto m1 = new Typeinsto(); and call the method m1.get() and m1.show() inside the do-while loop.
  • In do-while loop at least one time execute and then we ask user to do you want to continue and save it to int t with the help of Scanner Class.
  • Basically Scanner Class Declare in the package name import.java.util.Scanner ; it's similar to Header files in C , C++ Languages.
  • Before you going to check source code must read the Program explanation for better understanding of the whole source code.
  • Thank you >>>>>>>>>>>>> AMIT........



Here is the full source code...........





Click this below link -- -- ---- -- -- -

Here is the Output........


-----DETAILS OF MUSICAL INSTRUMENTS ARE------
--CHOOSE YOUR OPERATION TO PERFORM--
1.) string instruments
2.) wind instruments
3.) percussion instruments
1
-------strings instruments are shown below--------
veena
guitar
sitar
sarod
mandolin
--DO YOU WANT TO CONTINUE PRESS 1 FOR YES OTHER KEY FOR NO--
1
-----DETAILS OF MUSICAL INSTRUMENTS ARE------
--CHOOSE YOUR OPERATION TO PERFORM--
1.) string instruments
2.) wind instruments
3.) percussion instruments
2
--------wind instruments are shown below----------
flute
clarinet saxophone
nadhaswaram
piccolo
--DO YOU WANT TO CONTINUE PRESS 1 FOR YES OTHER KEY FOR NO--
1
-----DETAILS OF MUSICAL INSTRUMENTS ARE------
--CHOOSE YOUR OPERATION TO PERFORM--
1.) string instruments
2.) wind instruments
3.) percussion instruments
3
---------percussion instruments are shown below---------
tabla
mridangam
bangos
drums
tambour
--DO YOU WANT TO CONTINUE PRESS 1 FOR YES OTHER KEY FOR NO--
2

Compilation Terminated........



#STAYHOME 

THANKS ----------------

PROGRAM AMIT----------

Post a Comment

3 Comments

Write your comments or feedback here.........