informatics practices - assignments - wordpress.combased on java & sql) a practical workbook...
TRANSCRIPT
1
Informatics Practices - Assignments
(based on JAVA & SQL)
A Practical Workbook
Class XII
2
Assignments based on JAVA
1. Create a java Desktop application to find the largest number among the three floating –point
numbers. The following is the screen used to find largest number among three numbers:
2. Create a java Desktop application to enter your friends ROLLNO,NAME, ADDRESS,SECTION and
grade, Using a JButton ‘s click event handler, display the details of input into a JTextArea control.
Note that the JTextArea background would be in yellow color.
3. Create a java Desktop Application to find salary of the employee on the basis of “Designation
selected using JCombobox. The JCombobox contains the following designation with respective
salaries.
Designation Salary
Project Manager 200000
Manager 150000
Architect 100000
Team Leader 100000
Sr. Programmer 75000
Programmer 50000
Operator 25000
3
4. Create a Java Desktop application to do mathematical operations like ADDITION, SUBTRACTION,
MULTIPLICATION, DIVISION and MODULUS of two numbers and display the result with
appropriate text box after clicking a JButton control.
5. Write a program to input any number and print them in reverse order using while statement.
Whereas the input number must be positive. The following is the screen used to print the
reverse of a number.
6. Mr. Vidyarthi wotks in Blossoms Public School as a Programmer . he is required to develop a
student record. The school offers two different streams, Medical and Non-medical, with
different grading criteria. The school also offers incentive to the NCC cadets in the two streams
is given below
4
(A) Write the commands to disable the textboxes txtPercentage and txtGrade. Also, set
Medical as default stream.
(B) Write the code for cmdClacPer to calculate the percentage after finding the total marks of
first term and second term (assuming that both marks are out of 100). Also ensure
(C) Write the code for cmdClacGrade to calculate the grade depending on the stream selected
according to the criteria given below
(D) Write the code for cmdClear Command Button to clear all the text boxes and check box and
Medical as default stream.
7. Define a class report with the following specification
Data Member :
ADNO Integer
NAME String
Marks 5 Floating Point values
Average Average marks obtained
Getavg() to compute the average obtained in five subjects
Member methods
Read_info() function to accept values for ADNO,NAME,MARKS and invoke the function
getavg()
Displayinfo function to display all data member on the screen you should give function
definitions.
5
Calculate the average mark and print a message “You are Passed “ if percentage is greater than 40 ,
otherwise print “You are Failed “ . Also, at runtime , the colour of “ You are passed “ must be Blue and
“You are failed “ must be Red with font size 10.
8. Create an application to design a form counting ListBox and Combobox. Add major cities to both
ListBox and ComboBox through a TextBox, Also provide three command button for clearing the
TextBox ,ListBox and ComboBox. When you click on a button (JButton), the action will affect to
respective controls. Also , use command buttons for clearing the TextBox, ListBox and
ComboBox . See the form given below.
9. Read the following case study and answer the questions that follows:
Sagar electronics has the following products with their list prices given. The store gives a 10%
discount on every product. However, at the time of festival season, the store gives a further 7%
festival discount after 10%
6
Note that the product Name is stores in JComboBox control.
10. HDFC Bank frequently needs to calculate the interest and amount due for his clients. He ask his
software programmer to design an interest calculator which will calculate the compound
interest and amount due. The bank offers two different accounts fixed deposit and recurring
deposit with different rage criteria. The programmer uses Java language with NetBeans IDE to
develop this.
7
(A) Write the code to disable the text boxes txtInterest , txtAmount , txtRate and txtDate in the
form when the from activated.
(B) Write the code for cmdClear command button to clear all the textboxes and box except txtDate.
Set the default choice in the option button as Fixed Deposit.
(C) Write the code for the click event of the command button cmdCalculate to calculate compound
Interest and amount and display the values in textboxes txtInterest and txtAmount depending
on the principal, rate and time.
Note that the compound interest is calculates ad P*(l+r/100)^T & amount as Principal + Interest.
Rate is calculated based on the time according to the following table.
An additional rate of 2% is givento senior citizens i.e. if the chkSR chechbox ix checked
(D) Write the code for cmdExit to exit the application
11. Define a class Batsman with the following specification:
Data Members
BCODE Integer
BNAME String
INNINGS,NOTOUT Integer
8
RUNS Integer
BARAVG It is calculates according to the formula : bataavg=runs/(innings – notout)
Calcavg() Function to compute batavg
Member Function
readdata() Function to accept values for bcode, name , innings , notout and invoke the
calculate function calcavg()
displaydata() Function to display the data member on the screen.
(i) Define a class Batsman with required specification.
(ii) Write the code for Batting Average buttons click event procedure to operate the class
batsman’s method.
12. Develop a Java Desktop application to create a simple menu and perform its action event to
display simple messages for each menu item. Notice that the Menu item are shown as given figure :
9
Write the code for click event procedure for all File menu options with different dialog boxes
containing different icons.
13. Create a Java Desktop Application to perform the following calculations :
(a) Calculation of Total and Average Marks as :
total = english + maths + science + history
average = total / 4
(b) Displaying the Distinction / Average Marks based on the Total Marks scored.
(c) Displaying the grade (A, B, C, D, F) based on the Average Marks Scored.
Average Result Grade
>= 75 >= 60 >= 50 >= 40 Otherwise
Distinction First Class Second Class Average Fail
A B C D F
Enter four subjects’ marks called : English, Maths, Science and History. Also the entered marks
should be between 0 and 100 for each subject.
10
14. Create a java Desktop Application to find the Incentive (%) of Sales for a Sales Person on the
basis of following feedbacks :
Feedback Incentive (%)
Maximum Sales Excellent Customer Feedback Maximum Count of Customer
10 8 5
Note that the sales entry should not be space. Calculate the total incentive as : Sales amount *
incentive.
15. Develop a Desktop Application to test all String manipulation methods using a JButton click
event procedure. Note that the result of String manipulation methods will be placed in JTextArea
control. Note . The operations will be implemented using two strings as : your name and school.
11
16. Write an application to add records into the Customer table. The Customer table has the
following entities :
Field Name Data Type Width Constraint
Customer_Id Customer_Name Address Phone
Int Varchar Varchar Varchar
4 25 40 10
Primary Key Not Null
Note that the Java NetBeans IDE for customer data entry screen looks like as follows :
12
17. Write an application to navigate the above Customer table records using MoveFirst, MoveNext,
MoveLast and MovePrevious resultSet properties. Remember that the four operations will handle
by four different command buttons.