Practice Assignments
Take Num1 as first number, Num2 as second number, calculate and print the following
Sum=num1+num2
Diff=num1-num2
Prod=num1*num2
Div1= Decimal value of num1/num2
Div2= Quotient of num1/num2
Rem1= Reminder of num1/num2
Exp1=num1 to the power of num2
Create a text file in1.txt with 2 numbers written one below the other. Line 1 should contain 8, Line 2 should contain 4
Print Sum, Diff, Prod, Div1, Div2, Rem1, Exp1 on a single value separated by a space
Create a text file file in2.txt with 2 numbers written on a single line separated by a comma. Eg 8,4
Print Sum, Diff, Prod, Div1, Div2, Rem1, Exp1 on a single value separated by a space
Create a text file out1.txt which will print the above results on a single line separated by a space
Create a text file out2.txt which will print the avove results on different lines
Create a text file out2.txt which will print the avove results on different lines along with the labels on the left side. Eg Sum of 8 and 4 is:
Take Start and End as two inputs and print all Even Numbers between them separated by a space
Take Start and End as two inputs and bring all Odd Numbers between them separated by a space
Take Start and End as two inputs and create two ArrayLists even[] and odd[] containing Even and Odd Numbers respectively
Create a list called list3[] containing multiples of 3 from 1 to 100. Eg 3, 6, 9, 12
Create a list called list4[] containing mulitples of 4 from 1 to 100. Eg 4, 8, 12, 16
Create a list called list5[], list6[], list7[], list8[] and list9[]
Create a list called prime[] containing only prime numbers
Take Num1 as input and determine if it is Postive, Negative or Zero
Take in3.txt as input containing 10 numbers 4, -8, 0, 2, 9, -3, 7.5, 6, 0, 999. Create 3 different files positive.txt, negative.txt, zero.txt containing positive, negative and zero numbers respectively
Swap the values of two variables without using a temporary variable.
Calculate the factorial of a number entered by the user.
Calculate the factorial of a number using recursion.
Check if a number entered by the user is prime or not.
Find the maximum of three numbers entered by the user.
Print the Fibonacci series up to a given number.
Calculate the sum of digits in a given number.
Check if a string entered by the user is a palindrome.
Check if a given string is an anagram or not.
Count the number of vowels in a string entered by the user.
Reverse a string entered by the user.
Find the area of a circle given its radius.
Convert temperature from Celsius to Fahrenheit.
Find the largest element in an array. int[]even={2,4,6,8,10,20,40,80}
Sort an array of integers in descending order. int[]even={10,20,40,80,160,320}
find the common elements which are found in both the arrays.
Create a class called Rectangle with attributes length and width. Write methods to calculate the area and perimeter of the rectangle.
Create a class called Circle with attributes radius and a method to calculate the area of the circle.
Create a class called Student with attributes name and age. Implement getter and setter methods for these attributes.
Create a class called BankAccount with attributes accountNumber and balance. Write methods to deposit and withdraw money from the account.
Create a class called Car with attributes make, model, and year. Implement a method to display the car details.
Create a class called Employee with attributes name, salary, and designation. Implement a method to calculate the yearly bonus based on the salary.
Create a class called Person with attributes name and address. Implement a method to display the person's details.
Create a class called Book with attributes title, author, and price. Implement a method to calculate the discounted price of the book.
Create a class called Shape with an abstract method calculateArea(). Implement this class in subclasses such as Rectangle, Circle, and Triangle.
Create a class called Animal with methods eat() and sleep(). Implement subclasses such as Dog, Cat, and Bird with their own implementations of these methods.
Create a class called Bank with methods to add and retrieve customer information. Implement a separate class called Customer to represent a bank customer.
Create a class called EmployeeManagement with methods to add, update, and delete employee records. Implement a separate class called Employee to represent an employee.
Create a class called Shape with a method draw() and implement subclasses such as Circle, Rectangle, and Triangle with their own implementations of the draw() method.
Create a class called Vehicle with methods start() and stop(). Implement subclasses such as Car, Motorcycle, and Truck with their own implementations of these methods.
Create a class called BankAccount with methods deposit() and withdraw(). Implement subclasses such as SavingsAccount and CheckingAccount with their own implementations of these methods.
Create a class called Person with attributes name and age. Implement an interface called Playable with a method play(). Implement subclasses such as Child and Adult that implement the Playable interface.
Create a class called Shape with abstract methods calculateArea() and calculatePerimeter(). Implement subclasses such as Rectangle, Circle, and Triangle with their own implementations of these methods.
Create a class called Employee with attributes name and salary. Implement an interface called Taxable with a method calculateTax(). Implement subclasses such as Manager and Engineer that implement the Taxable interface.
Create a class called Bank with methods to perform banking operations such as openAccount(), closeAccount(), and transferFunds(). Implement a separate class called Account to represent a bank account.
Create a class called Shape with attributes color and filled. Implement subclasses such as Circle, Rectangle, and Triangle that inherit from the Shape class and