Java Practice Exercise – Packages

  • Write a java program that illustrates the following
    • Creation of simple package.
    • Accessing a package.
  • Write a java program using package to find the number is Armstrong number.
  • Write a java program to maintain the books details like Bookid, accession number, book name, author, publication in books package and keep the journal details such as journal id; journal name in journal package ; in main class use these packages details for staff and student classes and display the books and journals information as requested by the user
  • Write a Java program to create a Package “YEAR_I” which has a class YearIMarks (members – sub1mark, sub2mark). Create another package “YEAR_II” which has a class YearIIMarks (members – sub3mark, sub4mark ). Create n objects of Student class (having rollNumber, name, YearIMarks and YearIIMarks). Calculate the Grade (‘Pass’ > =50 else ‘Fail’) for each subject and display the result of the student in proper format.
  • Create a package named ‘com’. Define subpackages as specified below and Create one ‘LoanAccount’ object in main to perform operations on it by accepting command line arguments.
    • ‘transact’: with class ‘Transaction’ with static methods credit() and debit()
    • ‘loan’: with class ‘LoanAccount’ with method doTransaction() which calls Transaction class methods.