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

JavaAssignments (1)

cdac acts
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

JavaAssignments (1)

cdac acts
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Day1: 21-Sep-2024

1. Write simple java program to get person name from command line and
print Hello <Name> on console.

2. Write menu driven java program for performing Add, Subtract,


Multiplication and division of numbers.

3. Write menu driven java program with below options

● Calculate simple interest

● Calculate compound interest

4. Get 4-digit number from user, write a function to calculate sum of digits
of the 4-digit number: Using loop and Using recursion

5. Write a function for factorial and use the function for printing factorial
series like 1 2 6 24 120………

Day2: 23-Sep-2024

1. Write a Java program to allot grade student grade based on below


conditions
Up to 50% pass class
Up to 60% second class
Up to 75% First class
Above 75% Distinction.

2. Write a java program for printing patterns like below

*****
****
***
**
*
*
**
***
****
*****

*******
*** ***
** **
* *

*****
***
*
***
*****

3. Write a java program to sort an array of 10 numbers. Get array element


from user and use any sorting method you like.
Day3: 24-Sep-2024

1. Write a Java program to create Student class with properties with rollNo,
name, marks. Write printData method for printing Student. Create Default and
parameterized constructor. Generate rollNo automatically using static field.

Day4: 25-Sep-2024

Write a menu driven program to add Student objects in an array of students.


1. Add Student
2. Print Student by rollNo
3. Print All students Sorted by Marks
0. exit

Write a menu driven program to add Employee objects in an array of


Employees.
1. Add Employee
2. Print Employee by empId
3. Print All Employees Sorted by Salary
0. exit

Created overloaded static methods for printing an array of String and Integers
separately. Put these methods in ArrayPrinter class and call from main
ex.
public static void printArray(int[] arr) {}
public static void printArrray(String[] arr) {}

Day5: 26-Sep-2024

1. Write jav program to format given mobile number to expected


format as shown below.

Expected output +91-988-162-8598

Input +91-988-162-8598

Input +919881628598
Input 9881628598

Input 988162859 Error for less than 10 char

2. Implement toString() method in student class.

3.Write java program for billing of items purchased by customer. Create


an Item class with itemCode, itemName, price and quantity along with
getters and toString mthods.

Create an array of items holding stock of items. Create another array of


ietms for customer. When customer buy the Item by item code add
purchased item in an array. For every purchase create ietem using
Parametrized constructor.

Menus.

1. Display stock

2. But item by item code

3. Display bill

Day6: 27-Sep-2024

Revise all the Enum, Date and Assocaiation examples from class

1. Create Enum for course separately with values as DAC, DESD,


DVLSI. Use Course Enum and Date of Birth in Student class. Sort
student by Date of Birth using after/before methods of java.util.Date

2. Create Person class with basic details like addharNumber, name,


date of birth, address ( use Adress class for this). Find out whether
the person is born before 15th August 1947.

Day7: 28-Sep-2024
Topics Covered: Inheritance, abstract class, final variable, final methods,
final class, upcasting, down casting, overriding, co-varient return type.
Object class methods like getClass and toString. Wrapper classes boxing
and un boxing.

Students should revise and try all above concepts

1. Create account class acount number, accountName, dateOfOpening,


amount.

Add below functionality

1. Generate account number on account creation.

2. Add abstract method as double applyInterest() in the


account class

3. Create child classes as SavingAccount, CurrentAccount,


DepostAccount. Override double applyInterest() in the
child classes.

4. Interst percentage of Saving are 3%, Deposit 8%, and


Current as 1%

5. Use upcasting and demonstarte Dynamic method


dispatch.

6. Make is menu driven.

2. Create Shape class with abstract methods as

1. double calculateArea();

2. double calculatePerimeter();

Override these methods in child classes like Reactange and Circle.


Add additional method in Circle class as void draw() with
message( not need to drwa real Circle)

Create circle object and have Shape reference to it.

Call the draw method of circle with specific circle reference after
down casting from Shpae reference

Make is menu driven.

You might also like