Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
ITY 392 – PROGRAMMING LAB -3 Lab Objective 1) Introduction to object oriented programming concepts- java as an object oriented programming language. Introduction to java application and applets-control structures-methods-arrays. 2) Object based and object oriented programming creating packages-using overloaded constructorsstatic class variables-data abstraction and information hiding-relation between super class objects and subclass objects composition verses inheritance-polymorphism- dynamic method binding abstract super classes and concrete super classes –inheriting interface-use of inner classes and wrapper classes 3) Exception handling and multithreading in object oriented programming- When exception handling should be used-java exception handling – exceptions and inheritance-multithreading in java-thread synchronization-daemon threads Runnable interface Writing of the experiment: The student has to write the experiment as per the following format: a) Name of the experiment/Aim b) Algorithm c) Source Program d) Input and Output e) Result List of Lab Exercises S.No. Name of the program 1 Write a Java program to find simple Interest. 2 3 Write a Java program to find all arithmetic operation Write a Java program to convert any number to character number format from 0 to 9(Ex:i/p:1,o/p:one) Write a Java program to find the factorial of a given number Write a Java program to find first number is multiple of second Write a Java program to print number in sorting order Write a Java program to print the given number is Armstrong or not Write a Program to find the Roots of a Quadratic Equation for the given values Write a Program To print the Fibonacci series up to given numbers Write a Program To print the Prime Numbers upto given numbers 4 5 6 7 8 9 10 11 Write a Program To check whether the given string is Palindrome or not. 12 Write a Program To sort the given list of names 13 Write a Program To find the product of matrices 14 Write a Program That reads on a file and display the information that whether the file exists or not, to display the information about the file and find the type of file whether readable, writable and the length of bytes. 15 Write a Program That reads a file and displays the file on the screen within line number before each line 16 Write a Program That prints a number of characters ,words,lines in that file 17 Write a Java Program to define a class, describe its constructor, overload the Constructors and instantiate its object Write a Java Program to define a class, define instance methods for setting and Retrieving values of instance variables and instantiate its object Write a Java Program to demonstrate use of sub class Write a Java Program to demonstrate use of nested class Write a Java Program to implement Wrapper classes and their methods Write a Java Program to implement inheritance and demonstrate use of method overriding. 18 19 20 21 22 23 Write a program to demonstrate use of implementing interfaces 24 Write a program to implement the concept of threading by extending Thread Class Write a program to implement the concept of threading by implementing Runnable Interface 25 SAMPLE EXERCISE AIM: Write a java program to find the simple interest. Algorithm: Step by step procedure followed to find the simple interest Source Program public class SimpleInterestTest{ public static void main(String args[]) { //creating scanner to accept principle, rate and time input form user Scanner scanner = new Scanner(System.in); System.out.println("Welcome in Java program to calculate Simple interest"); System.err.println("Please enter principle amount :"); float amount = scanner.nextFloat(); System.err.println("Enter time in years : "); float time = scanner.nextFloat(); System.out.println("Enter rate annually : "); float rate = scanner.nextFloat(); float interest = simpleInterest(amount, rate, time); System.out.println("Simple interested calculate by program is : " + interest); } public static float simpleInterest(float principle, float rate, float time){ float interest = (principle*rate*time)/100; return interest; } } Output: Welcome in Java program to calculate Simple interest Please enter principle amount : 1000 Enter time in years : 1 Enter rate annually : 7 Simple interested calculate by program is : 70.0 Test Data: a) Valid data sets: 25000 int value as principal, 12.5f float value as rate, 2.75 as double as interestToPay b) Limiting value sets: Only integer values can be stored in the var. principal. c) Invalid data sets: If we assign float value in var. principal error will occur. Results for different data sets: Principalamount is Rs.25000 interest=Rs.8593.75 Total amount to pay to clear the loan = Rs.33593.75