Skip to main content
Home
Live to Learn!

Main navigation

  • Home
  • Learn
    • FoxPro
    • MS-DOS
    • C PRG
    • Java
    • ASP
    • Ruby on Rails
    • ASP.NET
    • E-Books
    • Exam Preparation
    • Tools
  • Blog
  • Forums
  • Contact
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Learn by Example - Java Sample Programs

Multiple Inheritance and Packages

Book navigation

  • Armstrong Number
  • Palindrome Checking
  • Playing Audio Clip using Applet
  • Applet Form
  • Exception Handling
  • Multiple Inheritance and Packages
  • Shopping List
  • Simple Multithread program
  • JDBC Program Select, Insert, Update, Delete records
  • RMI - Example AddServer
  • Simple Bank Account Process
  • TCP Server and Client in Java
  • UDP Server and Client in Java
  • FTP Server and Client in Java
  • Chat Server and Client in Java
  • Echo Server and Client in Java
  • Address Resolution Protocol in Java
  • Ping server and Client in Java
  • Multicast Server and Client in Java
  • Transposition Cipher Method
  • Poly-alphabetic Cipher Method Encryption - Java
  • DES - Using Data Encryption Standard in Java
  • AES - Using Advanced Encryption Standard in Java
  • Bit Stuffing
By Karthik , 25 November, 2011

package pack2;
public class student
{
public int rno, m1, m2, m3, tot;
public String name, result;
public void getdata(int x1,String x2, int x3, int x4, int x5)


{

    rno = x1;
    name = x2;
    m1 = x3;
    m2 = x4;
    m3 = x5;
    tot = m1 + m2 + m3;
    if((m1>=50)&&(m2>=50)&&(m3>=50))
        result ="pass";
else

    result = "fail";

}

public void putdata()


{

    System.out.println("Rollno: "+rno);
    System.out.println("Name: "+name);
    System.out.println("mark1: "+m1);
    System.out.println("mark2: "+m2);
    System.out.println("mark3: "+m3);
    System.out.println("Total : "+tot);
    System.out.println("Result: "+result);
    }
}

package pack1;
import java.io.*;
public interface sports

{
    public void setsum()throws IOException;

}

import pack1.*;
import pack2.*;
import java.io.*;
class result extends student implements sports
{
    int sm;
    String sname;
    public void setsum() throws IOException
    {
        InputStreamReader r = new InputStreamReader(System.in);
        BufferedReader b = new BufferedReader(r);
        System.out.println("Enter sports name");
        sname = b.readLine();
        System.out.println("Enter sports mark");
        String s = b.readLine();
        sm = Integer.parseInt(s);
        System.out.println(sm);
    }
public void display() throws IOException
    {
    setsum();
    putdata();
    System.out.println("Sports name :"+sname);
    System.out.println("Sports Mark :"+sm);

}
}

public class mult
{
public static void main(String args[]) throws IOException


    {
    result res = new result();
    res.getdata(101,"Karthik",98,90,95);
    System.out.println("student details");
            res.display();
    }
}
  • Add new comment

Comments

Featured Blog Posts

Convert Currency in Number to Words (Indian Rupees) - MS Excel
Foxpro Tutorial and Programs
Convert Currency in Number to Words in MS Word
Convert Currency in Number to Words (Indian Rupees) - Version 2
Best way to Use Rupee Symbol in Windows – Easy steps
Convert Currency in Number to Words - MS Access
Creating All in One Windows XP DVD with all Important Applications
RSS feed

© 2009-2025 Live to Learn.In

Terms of Use | Privacy Policy