0% found this document useful (0 votes)
358 views

Practical Exercise1

The document describes requirements for several Java applications: 1. An application to calculate bank account interest based on deposit amount and time. 2. An application for an IQ test with subjects and scoring that recommends an IQ level. 3. An application for bank transactions like deposits and withdrawals using classes. 4. An application to manage a CD catalog with options to add, search, and view CD details. 5. An application to calculate cricket player incomes using inheritance, interfaces, and factors like grade, matches, and performance.

Uploaded by

Arif Mohmmad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
358 views

Practical Exercise1

The document describes requirements for several Java applications: 1. An application to calculate bank account interest based on deposit amount and time. 2. An application for an IQ test with subjects and scoring that recommends an IQ level. 3. An application for bank transactions like deposits and withdrawals using classes. 4. An application to manage a CD catalog with options to add, search, and view CD details. 5. An application to calculate cricket player incomes using inheritance, interfaces, and factors like grade, matches, and performance.

Uploaded by

Arif Mohmmad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Practical Exercise1

Question1
Write a program for a bank accountant to calculate the interests, which customers will gain on
investing any amount of money for any given period of time. (Hint: Keep the rate of interest
as fixed.)
Question2
Howell University is an accredited European university, which offers a range of courses to its
students. It strives to give students the very best in terms of education and course content.
Now the university management is introducing a new IQ testing system for its MBA
students, which is an add-on to the traditional Examination System. This tests the IQ of the
students by testing them on four different subjects like Aptitude, English, Mathematics and
General Knowledge.
Consider yourself to be a part of the software development team that is supposed to design
the application in Java. First the application asks the student the number of attempt. If
student responds with a value higher than 1, then the application terminates and displays a
corresponding message. However, if the student is attempting the test for the first time, it
displays the following menu:
1. Aptitude
2. English
3. Math
4. GK
5. Exit
On entering a value between 1 and 4, the application displays the corresponding question.
Note that the student can attempt only once for each subject listed. When a student enters
the correct answer for the question, the score for that subject gets incremented by 10
points. Once the student appears the test for all the subjects, he/she can choose to exit the
application. After selecting the Exit option, the student can get the total marks printed on
the screen. The total scores should be calculated by adding up all the individual scores in
each subject. Next the application displays the following based on the score:
Bonus points earned
Total score out of 50
Message on IQ level
The application displays the bonus points based on the following conditions:
1. No bonus point is given, when the total score equals to 10.
2. A bonus of 2 points is given, when the total score equals to 20.
3. A bonus of 5 points is given, when the total score equals to 30.
4. A bonus of 10 points is given, when the total score equals to 40.
The message on IQ level is displayed on the basis of following conditions:
1. If the final score equals 10, then a message is printed saying Your IQ level
is below average".
2. If the final score equals 22, then a message is printed saying Your IQ level
Question 3
United Bank is an esteemed bank that provides banking services for profit. Its services
include receiving deposits of money, lending money and processing transactions. The
management of United Bank is looking at automation as a means to save time and effort
required in their work. In order to achieve this, the management has planned to
computerize the following transactions:
Deposit money in an account
Withdraw money from an account

The United Bank Manager and a team of experts have chosen your company to provide a
solution for the same. Consider yourself to be a part of the team that implements the
solution for designing the application.
Create an application using Classes and Objects to implement the transactions. The
application should consist of the following classes:
1. Account.java
2. AccountTest.java
Each file has a specific purpose and functionality. The descriptions of each file are as
follows.
Account.java
The Account class is used to store the details of the procedures followed in the bank such as
depositing money to the account and withdrawing money from the account.
The Account class contains instance variables amount and balance to store the actual
amount and the balance amount respectively.
Create a method named deposit() to allow the user to deposit some amount in his
account. This method should check whether the amount to be deposited in the account is
more than zero; otherwise display appropriate message.
Similarly, create a method named withdraw() to allow the user to amount from his
account. This method should check whether the amount to be withdrawn is not more than
the current available amount in the account; otherwise display appropriate message.
Finally, create a method getBalance() to return the balance in the account.
AccountTest.java.
The AccountTest class demonstrates the use of class, methods and objects in addition to
displaying a menu with options of depositing cash, withdrawing cash and quitting the
application.
Question 4
The CD House has the most complete collection of Different audio and video CDs, with over
700 individual titles. Now the company wants to introduce automation system to manage
the existing and newly added CDs. Consider you to be a part of the team that implements
the solution for designing the application.
Create an application in Java, which can be used to manage the CD catalog in real time by
adding new CDs with all the details captured, searching for existing CDs, displaying the
entire catalog with all the details. The application initially displays a menu with the following
options.
1.
2.
3.
4.

Add CD to the catalog


Search CD by CD title
Display the catalog
Exit

Implement the main menu which will display the above list of choices to navigate through
the CD catalog. When the user selects an option the corresponding function must be called.
The application terminates by printing an appropriate message and showing the
corresponding result, when the user chooses to exit the application.
When a user enters the first choice to Add CD, the application checks for space in the
array of CDs. If there is place in the array, it starts accepting all the details of the CD one
after the other. Otherwise it prints a message saying unable to add CD. The details of the

CD it accepts are: CD collection name (game/movie/music), CD type (audio or video), Title,


Price, CD id and year of release. The details are stored inside the array of CDs and the
cdcounter that counts the number of cds is incremented.
For selecting the choice 2 to search a CD by its title, the applicati on checks only if there is
CD existing in the catalog. If there is CD in catalog it starts searching by matching the userentered title with the existing CD titles. If the application finds a match, it returns the
details of that particular CD else it prints a failure message.
Now, for choosing option 3, which is displaying the CD catalog, it checks the condition,
whether there is any CD present in the catalog. The CD details are displayed until all the
CDs are displayed.
Finally the application exits safely when the option 4 that is Exit is selected.
Question 5
Australian Cricket is still the best team in the world and it has proved its supremacy in the
last two World Cups held in the successive years 1999 and 2003.
The department handling the finance of the players is planning to develop software that
would automatically calculate the income of the players based on their respective grade, the
number of matches each player plays and also his performance in the tournament. Also,
appropriate income tax should be applied on the income. To accomplish this, a team of
experts have been chosen by the Australian Cricket Board to provide a solution for the
same. Consider yourself to be a part of the team that implements the solution for
Designing the application.
Create an application using inheritance and interfaces to implement the Software. The
application should consist of the following files.
1.
2.
3.
4.
5.
6.

Player.java
Tax.java
PlayerIncome.java
GradeBonus.java
TournamentIncome.java
PlayerTest.java

Each file has a specific purpose and functionality. The descriptions of each file are as
follows:
Player.java
The Player class is an abstract base class that contains an instance variable to store the
name of the Player, and an abstract method.
The Booking class should contain an instance variable name to store the players name.
An abstract method named displayDetails() is created to display the name of the player.
Tax.java
An interface named Tax should be created that will act as an interface to calculate the tax
of the players income.
Declare and initialize a constant variable TAX_PERCENT to store the tax percentage. Also
create an abstract method named calculateTax() to calculate the tax.
PlayerIncome.java
The Player Income class should be a derived class of class Player and implement the
interface Tax. This class should be used to store the Player details and display the same.

You might also like