0% found this document useful (0 votes)
15 views8 pages

T3_SEM-I_JAVA-I_2023_9-MARKS-PRACTICE PROGRAMS

The document is a question bank for a Computer Programming course using Java at L.J Institute of Engineering and Technology, Ahmedabad. It includes various programming tasks such as creating classes for bank account management, employee appraisal systems, student data management, and a college result system, each with specific requirements and methods to implement. The tasks emphasize object-oriented programming concepts, data validation, and user interaction through console input/output.

Uploaded by

zaidmemon8156
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)
15 views8 pages

T3_SEM-I_JAVA-I_2023_9-MARKS-PRACTICE PROGRAMS

The document is a question bank for a Computer Programming course using Java at L.J Institute of Engineering and Technology, Ahmedabad. It includes various programming tasks such as creating classes for bank account management, employee appraisal systems, student data management, and a college result system, each with specific requirements and methods to implement. The tasks emphasize object-oriented programming concepts, data validation, and user interaction through console input/output.

Uploaded by

zaidmemon8156
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/ 8

L.J Institute of Engineering and Technology, Ahmedabad.

Computer Programming Using JAVA-I Question Bank SEM-I 2023

SEM-I JAVA-I 2023 (9 MARKS PROGRMAS)

TEST-3
1 Write a program using array of objects, which can be used by a banker to open new
accounts.
At the time of opening new account, the banker first enters the number of accounts to be
created. In each account, the information to be stored are- Account number( 10 digits),
Customer name, PAN number(10 digits alphanumeric with capital alphabets) and initial
balance(minimum 5000).
Create a class Account with data members as account number(AN), customer
name(name),account balance(balance) and PAN number(PAN).
Define a method setAccountNumber() that takes account number from the banker and
checks whether it is 10 digits only. If it is less than or greater than 10 digits then it must
print the message ‘Account number must be of ten digits only’ and if any other
keyboard character is entered, it must print the message ‘Account number contains 0
to 9 numbers only’ and prompts to enter the correct account number again.(EX.-
1234567891)
Define a method setName() which takes customer’s first_name, middle_name and last
name.
Define a method setBalance() which takes account balance as input, checks if it is
more
than 5000 and if not, prints the message ‘Initial balance must be more than 5000’ and
prompts to enter balance again.
Define a method setPAN() that accepts and checks whether the first 5 digits are capital
alphabets, next 4 digits are numbers between 0 and 9 and last digit is capital alphabet.
If not, it prints the message ‘The first 5 characters of PAN card are capital alphabets,
followed by 4 numeric digits and ending again with a capital alphabet’ and asks to
enter the PAN card number again.(EX.- ABCDE1234P)
Define a method printData() which prints the details of all accounts i.e. account
number, Customer name, balance and PAN number. The customer name must be
printed in the format- first_name middle_name last name.
Also, the program must contain a code to search an account number and display details
of that
account number. For that create method named searchData() in which Array of account
will
pass as argument(parameters). If an account number is not found, it must print a message
‘This account number does not exist in our bank’.
HINT:-
# INPUT:-
Enter total no of Accounts you want to add: 2
1
L.J Institute of Engineering and Technology, Ahmedabad.
Computer Programming Using JAVA-I Question Bank SEM-I 2023

----Enter Account 1 Data:----


Enter Account number: 12345
Account number must be of Ten digits only
Enter Account number: 1234567891
Enter Customer First name: ARYAN
Enter Customer Middle name: MANUBHAI
Enter Customer Last name: PATEL
Enter balance: 4000
Initial balance should be minimum 5000:
Enter balance: 50001
Enter PAN card number: 12345ABCD1
PAN number must be of total TEN alphanumeric only, in which the first 5 characters of
PAN
card are capital alphabets, followed by 4 numeric digits and ending again with a capital
alphabet
Enter PAN card number: BWBPP4524U
----Enter Account 2 Data:----
Enter Account number: 1234561234
Enter Customer First name: SHANVI
Enter Customer Middle name: DIPKUMAR
Enter Customer Last name: PATEL
Enter balance: 6001
Enter PAN card number: ABCDE1234K
# OUTPUT:-
=============================
====Bank Accounts Details========
=============================
Account id= 1234567891
Customer name= ARYAN MANUBHAI PATEL
Account Balance= 50001.0
PAN card= BWBPP4524U
Account id= 1234561234
Customer name= SHANVI DIPKUMAR PATEL
Account Balance= 6001.0
PAN card= ABCDE1234K
======================================
# EXAMPLES FOR searchData() MATHOD:-
EX:-1
Enter Account id you want to Search: 1234567891
Account id= 1234567891
2
L.J Institute of Engineering and Technology, Ahmedabad.
Computer Programming Using JAVA-I Question Bank SEM-I 2023

Customer name= ARYAN MANUBHAI PATEL


Account Balance= 50001.0
PAN card= BWBPP4524U
EX:-2
Enter Account id you want to Search: 1234123412
This account number does not exist in our bank
2 Company Director has to prepare Appraisal report for yearly increment for his
employees.
So, the requirements of Director’s are given below. Kindly prepare java program to help
company’s director to prepare appraisal sheet.
First you have to create one class with name EmployeeData
Attributes or instance members of EmployeeData class are as per given below: -
• emp_name (String)
• emp_id (int)
• emp_joining_year (int)
• emp_salary(double)
• emp_designation (String) – must be from following three only : 1) junior,
2) executive, 3) manager
• emp_experience (integer)
• emp_incremented_salary(double)
Tasks you have to perform for this same class are as per given below.
1. Prepare record of n employees (using array of object concept) for appraisal
process using one method which name must be setData() in which you have to
initialize only given instance data members: emp_name (String), emp_id (int),
emp_joining_year (int), emp_salary(double) ,emp_designation (String)- junior,
executive, manager.
Note: emp_experience and emp_incremented_salary – we will initialize these
instance members later.
2. Prepare one method which name must be experience() and calculate
emp_experience instance member using emp_joining_year. Ex: if
emp_joining_year is 2010 then till today the emp_experience will be: 13 Years
3. Prepare three different method for increment calculation in which you have to
calculate instance member emp_incremented_salary
For junior employee method name must be appraisalJunior ();
For executive employee method name must be appraisalExecutive ();
For manager employee method name must be appraisalManager ();
I. Calculate appraisalJunior() as per given below:
➢ if employee post is junior and experience is less than or equal to
2 years then emp_incremented_salary is original salary +10%
of original salary.
3
L.J Institute of Engineering and Technology, Ahmedabad.
Computer Programming Using JAVA-I Question Bank SEM-I 2023

➢ If post is junior and experience is greater than 2 years then


emp_incremented_salary is original salary +20% of original
salary
II. Calculate appraisalExecutive() as per given below:
➢ if employee post is executive and experience less than or equal
to 1 year then emp_incremented_salary is original salary
+10% of original salary+ Rs. 500 bonus.
➢ if employee post is executive and experience is greater than 1
years then emp_incremented_salary is original salary +15% of
original salary+1000 bonus.
III. Calculate appraisalManager () as per given below:
➢ if employee post is manager and experience less than or equal
to10 years then emp_incremented_salary is original salary +
5% of original salary.
➢ if emp post is manager and experience is greater than 10 years
then emp_incremented_salary is original salary +15% of
original salary.
4. Print all employee data using printData() method.
5. Prepare one employeeSort() method and print all employees in order of highest to
lowest value of emp_incremented_salary.
Expected Output:
Enter Total Employees:3
Enter Details of Employee 1
Enter Employee ID: 1
Enter Employee Name: amit
Enter Employee Designation: junior
Enter Employee Joining Year: 2020
Enter Employee Salary: 10000
Enter Details of Employee 2
Enter Employee ID: 2
Enter Employee Name: sumit
Enter Employee Designation: executive
Enter Employee Joining Year: 2015
Enter Employee Salary: 20000
Enter Details of Employee 3
Enter Employee ID: 3
Enter Employee Name: vinit
Enter Employee Designation: manager
Enter Employee Joining Year: 2010

4
L.J Institute of Engineering and Technology, Ahmedabad.
Computer Programming Using JAVA-I Question Bank SEM-I 2023

Enter Employee Salary: 10000


--------------Employee Data----------
Details of Employee 1
Employee ID:1
Employee Name:amit
Employee Joinig Year:2020
Employee Experiennce:3
Employee Designation:junior
Employee Original Salary:10000.0
Employee Incremented Salary:12000.0
Details of Employee 2
Employee ID:2
Employee Name:sumit
Employee Joinig Year:2015
Employee Experiennce:8
Employee Designation:executive
Employee Original Salary:20000.0
Employee Incremented Salary:24000.0
Details of Employee 3
Employee ID:3
Employee Name:vinit
Employee Joinig Year:2010
Employee Experiennce:13
Employee Designation:manager
Employee Original Salary:10000.0
Employee Incremented Salary:11500.0
--------------Sorted Data----------
Details of Employee 1
Employee ID:2
Employee Name:sumit
Employee Joinig Year:2015
Employee Experiennce:8
Employee Designation:executive
Employee Original Salary:20000.0
Employee Incremented Salary:24000.0
Details of Employee 2
Employee ID:1
Employee Name:amit
Employee Joinig Year:2020
Employee Experiennce:3
5
L.J Institute of Engineering and Technology, Ahmedabad.
Computer Programming Using JAVA-I Question Bank SEM-I 2023

Employee Designation:junior
Employee Original Salary:10000.0
Employee Incremented Salary:12000.0
Details of Employee 3
Employee ID:3
Employee Name:vinit
Employee Joinig Year:2010
Employee Experiennce:13
Employee Designation:manager
Employee Original Salary:10000.0
Employee Incremented Salary:11500.0
3 Create a class Student which has Roll_no as int data member, Name as String data
member,
Mobile as long data member and City as String data member.
Class has following method:
1. set() for initializing data member and this method also validate the mobile
number.Mobile number must be 10 digit. Display “Invalid mobile number” if
mobile number is not 10 digit. And user also re-enter the valid mobile number.
2. display() to print the data.
3. searchByRollNo() which search student by roll number.
4. modifyByRollNo() which modify student name by using roll number.
Create a Main class in which N Students to be created. Use array of object.
Main class should display the following menu:
1.Display
2.search by Roll no
3.Modify name by Roll no
4.for Exit
This menu will stop if user press 4.
4 Write a JAVA program as per given instruction.
Create a class named “Student” in which you have to store data of students in instance
variables named “Rollno”, “Name”, “Percentage”.
Create necessary methods to perform following operations in “Student” class.
1. “set” -- for assigning data of Students.
2. “get” (without return type & without argument) -- for displaying data of individual
Students.
3. “get” (without return type & with argument) -- for displaying data of all Students.
4. "sort" -- for sorting data of Students based on their Rollno in ascending order without
using
inbuilt method.
5. "find" -- for searching data of Students based on their Rollno.
6
L.J Institute of Engineering and Technology, Ahmedabad.
Computer Programming Using JAVA-I Question Bank SEM-I 2023

(Take Rollno from user using scanner class and if Rollno exist then display
details using get() method else print message "Record Not Found!!")
6. "update" -- for updating the name of a Student to Upper case based on their Rollno.
(Take Rollno from user using scanner class and if Rollno exist then Update
name to Upper case and then display details of all student using get() method
else display old record)
Note: You have to create methods with the name same as given above and set category
of “get"
methods as per instruction, for remaining methods you can set as per your understanding.
-- Create another class named "RUN" which includes the main method. (use array of
objects
concept)
-- Take size of array through command line argument, call methods of "Student" class
from
this class.
5 Write a JAVA program that executes following Result System.
• TASK 1:
Create a class College. Create a method login for a new faculty entering marks first time.
Login
method first displays message "Welcome to Online Result Portal". Faculty must Login
with
the default password 1234. If password entered does not match with the default
password, the
screen displays "Invalid Password" and provides chance to re-enter the password. The
total
number of attempts must be only 2. After 2 wrong attempts the screen must display the
message "Your account is locked for 1 hour" and exit from the program.
If the password matches with the default password, display message "Successful Login".
The
next step must need to be to change the default password using method resetPassWord.
resetPassWord method first displays message "Reset Password". New entered password
must
satisfy below conditions:
1. Password length must be 4 digits only. (Ex: 2134)
2. It should have only digits.
3. No alphabet or space or special characters allowed.
If password not entered as per above condition then display message "Invalid
combination,
enter valid password". This method must execute until password changed successfully.
• TASK 2:
7
L.J Institute of Engineering and Technology, Ahmedabad.
Computer Programming Using JAVA-I Question Bank SEM-I 2023

After successfully changing the password, call a method enterMarks to enter marks of 5
students for three subjects Maths, Physics and Java using set method. Maximum marks
for
each subject is 25. Create method enterMarks by passing array as argument. Declare at
least 5
students.
• TASK 3:
Create method calculateSubjectTotal by using call by reference concept. Calculate
percentage
of three subjects. Create method display to print percentage of each subject. Create
method
subjectRanking to find Highest ranking subject based on percentage by using call by
value
concept. Last statement of program should Print message: "Highest Result is in subject :
(Subject Name) ".
EX: Highest Result is in subject : Maths
Use above all created methods.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy