#include <stdio.h> #define ROWS 3 #define COLS 3 void matrixMultiply(int *mat1, int *mat2, int *result, int rows1, int cols1, int cols2) { int i, j, k; // Multiplying matrices for (i = 0; i < rows1; i++) { for (j = 0; j < cols2; j++) { *(result + i * cols2 + j) = 0; for (k = 0; k < cols1; k++) { *(result + i * cols2 + j) += *(mat1 + i * cols1 + k) * *(mat2 + k * cols2 + j); } } } } void displayMatrix(int *mat, int rows, int cols) { int i, j; // Displaying matrix for (i = 0; i < rows; i++) { for (j = 0; j < cols; j++) { printf("%d\t", *(mat + i * cols + j)); } printf("\n"); } } int main() { int mat1[ROWS][COLS] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; int mat2[ROWS][COLS] = {{9, 8, 7}, {6, 5, 4}, {
Ignou question paper java
java
Java Solution |
BCSL 43
dec2016
solution
Video
BCSL 43
june2016
Solution
Video
BCSL 43
dec2015
Solution
Video
BCSL 43
june2015
Solution
video
BCSL 43
dec2014
Solution
Video
BCSL 43
june2014
Solution
Video
BCSL 43
dec2013
Solution
Video
BCSL43
june2013
Solution
Video
Dec2016 1.Write a Java program to create an applet to find the simple interest on a given amount, rate of interest and duration. Use proper GUI components in your program. import java.util.*; import java.awt.*; import java.awt.event.*; import java.applet.Applet; /**/ public class simpleinterest extends Applet{ Label l1,l2,l3,l4; TextField t1,t2,t3; Button b1; Image picture; public void init(){ picture = getImage(getCodeBase(),"20160613_091125.jpg"); l1=new Label("Enter the Amount "); l2=new Label("Enter the Rate "); l3=new Label("Enter interest Duration :"); l4=new Label(""); t1=new TextField(); t2=new TextField(); t3=new TextField(); b1=new Button("Chick here show result"); setLayout(null); l1.setBounds(80,30,100,20); t1.setBounds(250,30,100,20); l2.setBounds(80,60,100,20); t2.setBounds(250,60,100,20); l3.setBounds(80,90,150,20); t3.setBounds(250,90,100,20); b1.setBounds(150,120,150,25); l4.setBounds(150,150,150,25); add(l1); add(t1); add(l2); add(t2); add(l3); add(t3); add(b1); add(l4); t1.setForeground(Color.blue); l1.setForeground(Color.red); t2.setForeground(Color.green); l2.setForeground(Color.pink); t3.setForeground(Color.red); l3.setForeground(Color.blue); b1.addActionListener(new MyHandler()); } public void paint(Graphics g) { g.drawImage(picture, 0,0, this); } public class MyHandler implements ActionListener { public void actionPerformed( ActionEvent e) { int amount,rate,interest_time,simpleI; amount=Integer.parseInt(t1.getText()); rate=Integer.parseInt(t2.getText()); interest_time=Integer.parseInt(t3.getText()); simpleI=(amount*rate*interest_time)/100; l4.setText("simple Interest "+simpleI); } } } complie simpleinterest.java run appletviewer simpleinterest.java2.Write a Java program to create an Account class. Define proper constructor for this class. Define methods for the following : (a) To display the account details. (b) To show the current balance. (c) To show the rate of interest . Make necessary assumptions, wherever required. import java.util.*; class account{ String name; int Account_balance=100000; int withdraw; int Current_balance; double interest; account(){ System.out.println("Enter the Account holder Name: "); Scanner in=new Scanner(System.in); name=in.nextLine(); System.out.println("Enter the Withdrow Amount : "); withdraw=in.nextInt(); if(withdraw>0 && 100000>=withdraw){ Current_balance=Account_balance-withdraw; } else{ System.out.println("Amount is insuficiant"); } } void account_details(){ System.out.println("Show the Account Holdder Name : "+name); } void current_balance(){ System.out.println("Show the Account Holdder Name : "+Current_balance); } void Rate_interest(){ interest=Current_balance * 0.05; System.out.println("Show the Interest Rate : 5%"); System.out.println("Show the with interest Amount: "+interest); } } class Account{ public static void main(String arg[]){ account o1=new account(); o1.account_details(); o1.current_balance(); o1.Rate_interest(); } } 3.Write a Java program to create a Vehicle class. Derive Car and Bus classes from the Vehicle class. Define appropriate constructors for all the three classes. Define methods to display vehicle details (including model, price, vehicle number). Make necessary assumptions, wherever required. 4.Write a Java program to perform the following operations on string(s) : (a) To concatenate two strings (b) To find the length of a given string. (c) To convert a given string into upper case |
---|
import java.util.*; class concat{ String a1,a3; int a; concat(){ String s1=" pikachu"; String s2="is cotton"; a=s2.length(); a1=s1.concat(s2); String a3=toUpperCase(); System.out.println(a1); System.out.println("LEngth: "+a); System.out.println("upper case: "+a3); }} class display{ public static void main(String arg[]){ concat a2=new concat(); }} mothod using import java.util.*; //Write a Java program to perform the following operations on string(s) : //(a) To concatenate two strings //(b) To find the length of a given string. //(c) To convert a given string into upper case class string{ String s1="i am"; String s2="mannu"; String a1,a2,a3; int len,len1; void concatenate(){ a1=s1.concat(s2); System.out.println("........To concatenate two strings.......\n"); System.out.println(" Add Two string : "+a1); } void stringlength(){ len=s1.length(); //string length is a function it is count space ex; i am len1=s2.length(); //it's three word but cout space lengthis 4 System.out.println("\n\n..........String Length Find........"); System.out.printf("\n(i am) First String Length is "+len); System.out.printf("\n(mannu) second string Length is "+len1); } void uppercase(){ a2=s1.toUpperCase(); a3=s2.toUpperCase(); System.out.println("\n\n.... To convert a given string into upper case...."); System.out.println("\n(i am) convert is string uppercase "+a2); System.out.println("\n(mannu) convert is string uppercase "+a3); } } class stringdesplay{ public static void main(String arg[]){ string o1=new string(); o1.concatenate(); o1.stringlength(); o1.uppercase(); } }
June2016 1.Write a Java program to create an account class. Define appropriate constructor for this class. Define and implement method to display account balance and withdraw money. Show appropriate message if there is an attempt to withdraw money which may lead to account balance, less than minimum amount required in account. Make necessary assumptions required. 2.Write a Java program to find the average marks of 20 students in class for assignments. Make necessary provision for exceptions handling in your program. 3.Write a Java program to generate Fibonacci series. The starting number for the series should be 0. Define proper class, constructor and method(s) in your program. 4.Write a Java program to create an applet to generate table of a given number between 1 to 20. If number is out of this range ask for new input for the number. |
---|
Dec2015 1.write a Java program to create Player class. Derive Cricket_Player and Football_Player classes from Player class. Define proper constructor for all the classes. Also define Display_Info method in all the three classes to display details of the players. solution: import java.util.*; class player{ String name; int age; player(String name1,int age){ System.out.println("name : "+name1); System.out.println("age : "+age); }} class criket_player extends player{ criket_player(String add_c){ super("mannu kumar",17); System.out.println("TYPE : "+add_c); System.out.println("\n\n"); }} class foodball_player extends player{ foodball_player(String type){ super("reena negi",18); System.out.println("TYPE : "+type); } } class player1{//main class public static void main(String arg[]){ criket_player a2=new criket_player("criket_player"); foodball_player a3=new foodball_player("foodball_player"); } }2.Write a Java program to add two matrices, with proper implementation of exception handling mechanism. 3.write a Java program to create Complex_Number class and create objects of complex numbers. Define proper constructor for this class. Define the method to find the sum of two complex numbers and display the sum. solution: import java.util.*; class complex{ int real,imag; complex(){ } complex(int real1,int imag1){ real=real1; imag=imag1; } complex addtwonumber(complex c1,complex c2){ complex temp=new complex(); temp.real=c1.real+c2.real; temp.imag=c1.imag+c2.imag; return temp; } } class complexnumber{ public static void main(String []arg){ complex c1=new complex(4,8); complex c2=new complex(5,1); complex c3=new complex(); c3=c3.addtwonumber(c1,c2); System.out.println("sum :"+c3.real+"+i"+c3.imag); } }4.write a Java program to create an applet to draw a circle. Set background color of the circle as red. Also write your name and roll number below the circle. |
---|
June2015 1.write a Java program to perform the following on any given string : (i) To find its length (ii) To convert it to upper case (iii) To check whether it is a palindrome or not 2.rite a Java program to create an applet to find the sum of three numbers. Use proper GUI components and layout in your program. 3.write a Java program to create two threads named MyThread and YourThread. Both the threads need to print numbers from 1 to 10. (i) Compile and run the program with both the threads having default thread priority. (ii) Assign thread priority 6 to MyThread and thread priority 7 to YourThread, then compile and run the program. 4.write a Java program to create Account class. Derive Saving_Account and Current__Account classes from Account class. Define proper constructor for each of the classes. Define methods to display account details of each account type; using method overriding. Use appropriate data members and access specifiers in your program. |
---|
Dec2014 1.write a Java program which take two strings as input and do the following : (i) Find the length of the strings. (ii) Print the Initial characters of the words in string one (If string is Aj ay Kumar ; print AK). (iii) Concatenate string one to string two. (iv) Reverse the string obtained at point (iii) above. 2.write a Java program to create an Account class. Define proper constructor(s) for this class. Define methods to calculate Simple interest and Compound interest on the amount deposited in the account. Make necessary assumptions, wherever required. 3.write a Java program to find S [i] = A [i] + B [i] ; where S, A and B are arrays of integers. Your program should have provison for exceptions handling. Define proper class(es) and method(s) in your program. 4.write a Java program to find S [i] = A [i] + B [i] ; where S, A and B are arrays of integers. Your program should have provison for exceptions handling. Define proper class(es) and method(s) in your program. |
---|
June2014 1.Write a Java program to create an Applet which takes radius and colour as inputs and draws the circle of that colour. 2.write a Java program to create two threads Ti and T2, set priority of T1 to seven and T2 to six. Ti should print no. 1 ... 10 and T2 should print no. 11 ... 20. 3.write a Java program which performs the following on a given string : (i) Reverse the string. (ii) Convert all the lowercase letters to uppercase. (iii) Find the length of the string. (iv) Print the first and last characters of the string. 4.Write a Java program to create class Time with overloaded constructors to create Time objects in different formats. Also define methods to perform addition and difference operations on two given Time objects. |
---|
Dec2013 1.Write a Java program to create a shape class and derive, square and circle classes from shape class. Define appropriate constructor for all the three classes. Define a method Area( ) to calculate area of circle and square in respective class. Assume PI = 3.14 and declare it as a final variable in circle class. 2.Write a Java program to find the average marks obtained by five students in a class, in subjects Math, English and Science. You need to define proper constructor for the class you create to solve this problem. Also there should be a data member to keep students roll number. 3.Write a Java program to create an Employee class to manage employees information such as, employee name, id, date of birth, designation and basic salary. Define proper constructor for this class. Define methods to display employee details and Net Salary. The Net Salary is sum of basic salary + HRA + DA, where HRA is 20% of basic salary and DA is 70% of basic salary. 4.Write a Java program to make simple calculator to perform +, * and / operations. All the data members should be of integer type and you need to take care of exceptions handling in this program, properly. |
---|
june2013 1.Write a Java program to create student class. Define proper constructor to initialize student class object. Define methods to get details of any student (the details may include student name, address, program of study, age). You need to take care of exceptions handling in this program. 2.Write a Java program to create a simple calculator. This calculator should perform +, —, *, /. You need to take care of exceptions handling properly in this program. 3.Write a Java program to create a Matrix class. Define a constructor to create a 3 x 3 matrix object. Also define a method to find the maximum element in a given matrix and display its position in the matrix. Note : position of an element means its location in terms of row and column. 4.write a Java program to create ACCOUNT Class and define constructor(s) and methods for it. Derive Saving-ACCOUNT Class from ACCOUNT Class and override constructor of ACCOUNT Class. Make necessary assumptions wherever required. |
---|
Comments
Post a Comment