Sunday, 12 March 2023

Unit 1 Java Programs


1. Write a program to evaluate simple interest of a given principle, rate and time.


2. A motor cycle dealer sells two-wheelers to his customer on loan, which is to be repaid in 5 years. The dealer charges simple interest for the whole term on the day of giving the loan itself. The total amount is then divided by 60(months) and is collected as equated monthly instalment (EMI). Write a program to calculate the EMI for a loan of Rs. X, where X is given from command line argument. Print the EMI value in rupees.


3. A car accessories shop assigns code 1 to seat covers, 2 to steering wheel covers , 3 to car lighting and 4 for air purifiers. All other items have code 5 or more. While selling the goods, a sales tax of 2% to seat covers ,3% to steering wheel covers, 4% to car lighting, 2.5% to air purifiers and 1.2% for all other items is charged. A list containing the product code and price is given for making a bill. Write a java program using switch statements to prepare a bill.


4. Write a java program to scan 3 integer values from the command line argument and display the maximum number using conditional operator.


5. Write a program to calculate the hypotenuse of right angled triangle when other sides of the triangle are given. (Hypotenuse = square root (x*x + Y *Y))


6. Write a program to calculate the area of square and rectangle by overloading the area method.


7. Create a complex number class. The class should have a constructor and methods to add, subtract and multiply two complex numbers and to return the real and imaginary parts.


8. A shop during festival season offers a discount 10% for purchase made up to Rs.1,000, 12% for purchase value of Rs.1,000 or more up to Rs 1,500 and 15% for purchase value of Rs.1,500 or more. Write a program to implement the above scheme for a given sales and print out the sales and print out the sales value, discount and net amount payable by a customer. Create necessary methods and constructors


9. A bank gives 6.5% per annum interest on deposits made in that bank. Write a program to calculate the total amount that a person will receive after the end of 5 years for a deposit of Rs.5000 for compound interest. Create necessary methods and constructors too.


10. Write a java program to display powers of 2 i.e. 2,4,8,16 etc up to 1024 using bitwise operators.




No comments:

Post a Comment

python programs

1. sum of two number