Home Answers Viewqa JavaScriptQuestions convert it to BufferedReader class

 
 


Muhammad Hafizuddin
convert it to BufferedReader class
2 Answer(s)      2 years and 4 months ago
Posted in : JavaScript Questions

import java.util.*; public class method { static Scanner console = new Scanner (System.in);

public static void main (String[] args)
{
    int num1,num2,maximum,minimum; 
    double average;

    System.out.print ("Enter two numbers : ");
    num1=console.nextInt();
    num2=console.nextInt();

    maximum = myMax (num1,num2);
    minimum = myMin (num1,num2);
    average = myAvg (num1,num2);
    System.out.println ("The large number is "+maximum);
    System.out.println ("The small number is "+minimum);
    System.out.println ("The average of the numbers is "+average);

}

public static int myMax (int x,int y)
{
    int maximum;

    if (x >= y)
        maximum = x;
    else
        maximum = y;

    return maximum;
}

public static int myMin  (int x,int y)
{   
    int minimum;

    if (x <=y)
        minimum = x;
    else
        minimum = y;

    return minimum;
}

public static double myAvg (int x,int y)
{
    double average;
    double sum;

    sum = x+y;
    average = sum / 2;

    return average;
}

}

View Answers

January 21, 2011 at 10:53 AM


Hi Friend,

Here is the required code:

import java.io.*;
public class method {
public static void main (String[] args)throws Exception
{
    int num1,num2,maximum,minimum; 
    double average;

    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    System.out.print ("Enter First number: ");
    num1=Integer.parseInt(br.readLine());
    System.out.print ("Enter second number: ");
    num2=Integer.parseInt(br.readLine());

    maximum = myMax (num1,num2);
    minimum = myMin (num1,num2);
    average = myAvg (num1,num2);
    System.out.println ("The large number is "+maximum);
    System.out.println ("The small number is "+minimum);
    System.out.println ("The average of the numbers is "+average);

}

public static int myMax (int x,int y)
{
    int maximum;

    if (x >= y)
        maximum = x;
    else
        maximum = y;

    return maximum;
}

public static int myMin  (int x,int y)
{   
    int minimum;

    if (x <=y)
        minimum = x;
    else
        minimum = y;

    return minimum;
}

public static double myAvg (int x,int y)
{
    double average;
    double sum;

    sum = x+y;
    average = sum / 2;

    return average;
}
}

Thanks


January 23, 2011 at 11:27 AM


hi friend!! wahh.. a bit same but more complicated.. anyway,, thanks a lot yah!! :)









Related Pages:
convert it to BufferedReader class
convert it to BufferedReader class  import java.util.*; public class... is the required code: import java.io.*; public class method { public static void main...; double average; BufferedReader br=new BufferedReader(new InputStreamReader
BufferedReader
BufferedReader  What is BufferedReader used for?   BufferedReader read text from a character-input stream, buffering characters so... data from the file and console. Here is an example: import java.io.*; class
Convert InputStream to BufferedReader
Convert InputStream to BufferedReader   ... a input stream. java.io. BufferedReader class provides efficient way...) class. This data is in the form of bytes. To convert the byte form
Java bufferedreader
bufferedreader class? How bufferedreader can be used to read a file? Thanks   In Java the BufferedReader class is used to read the stream successfully with buffering. The BufferedReader class provides efficient reading from the input
Read bufferedreader
Read bufferedreader  Tell me the example of Read file using bufferedreader. Thanks   Read the tutorial Reading file using BufferedReader class. Thanks
About BufferedReader
About BufferedReader   I have created FileInputStream fstream..."); DataInputStream in = new DataInputStream(fstream); BufferedReader bfr = new BufferedReader(new InputStreamReader(in)); for(int i=0;i<10;i++) { String Str
Bufferedreader example
Bufferedreader example Here we have provided the best links for Bufferedreader class examples. You can use Bufferedreader class for buffering while reading... of Bufferedreader class Bufferedreader tutorial Bufferedreader Thanks
Why bufferedreader is used in java?
of BufferedReader class in Java? why bufferedreader is used in java? It will be great if anyone can give me the example code of BufferedReader class in java. Thanks   Hello, The BufferedReader class is present in the java.io package
Java IO BufferedReader
Java IO BufferedReader In this section we will discuss about the BufferedReader class in Java. BufferedReader class in java.io package is used for read... be specified. In most of the purposes default size of buffer is used. BufferedReader
what is the default buffer size for bufferedreader
of the BufferedReader class is 8192 chars, which is sufficient for general programming. Developers around the world is using java.io.BufferedReader class to create... is the default buffer size for bufferedreader? Is there any example of reading the big
BufferedReader in Java
can change the buffer size or can use default size. BufferedReader class in Java...BufferedReader in Java is used to to read characters, arrays, lines and File... by line data from a file using BufferedReader. BufferedReader Constructor
How To Read File In Java with BufferedReader
How To Read File In Java with BufferedReader class - example code This tutorial shows you how you can read file using BufferedReader class in your program. This tutorial is using the BufferedReader class for reading simple text file
How to Read a file line by line using BufferedReader?
. Thanks   Hi, You are right you can use the BufferedReader class... class. The BufferedReader is present in java.io package. You can import...How to Read a file line by line using BufferedReader?  Hello Java
Java convert string to InputStream
used the BufferedReader class to read and display the converted InputStream. Here...Java convert string to InputStream In this section, you will learn how to convert string to Inputstream. In one of the previous sections, we have discussed
Convert Character into Integer
Convert Character into Integer       In this section, you will learn to convert the character into a integer. The java.lang package convert provides the facility to convert
Number Convert - Java Beginners
Some value like 234.Value can be convert into Two Hundred and Thirty Four Rupees... import java.io.*; public class NumberToWord { String string; String... static void main(String args[]) throws IOException{ BufferedReader buff = new
Java Convert Octal to Binary
Java Convert Octal to Binary In this tutorial, you will learn how to convert... of different numbers. You can convert and decimal to octal, decimal to binary... number to binary. Example: import java.io.*; class ConvertOctalToBinary
BufferedReader/Writer
BufferedReader class is used to read the data in buffer.   The BufferedWriter class is used for buffered writing writing of data.   BufferedReader... Java Notes BufferedReader/Writer Example code of BufferedReader
Convert Text File to PDF file
Convert Text File to PDF file  Here is the way how to covert your Text file to PDF File, public class TextFileToPDF { private static void doReadWriteTextFile() { try { BufferedReader inputStream = new
convert jpeg to gif - Swing AWT
convert jpeg to gif  i want to convert jpeg file to gif file. in the roseindia's already existing program,i can convert gif to jpeg.But i cant convert jpeg to gif. help me plz....  Hi friend, import java.io.
Convert String to Class - JSP-Servlet
Convert String to Class  Hi all, I am using Quartz as a scheduler.... Reading job name, class name, day & time using xml file only. Problem is while reading class name, retrieve as a string format but Quartz required in "Class" format
Convert Text File to PDF file
Convert Text File to PDF file  import java.io.BufferedReader; import...; public class TextFileToPDF { private static void doReadWriteTextFile() { try { BufferedReader inputStream = new BufferedReader(new
Convert this code to GUI - Java Beginners
Convert this code to GUI  I have written this.i need to convert... java.awt.event.*; public class CompString{ public static void main(String[] args) { System.out.println("Enter two strings:"); BufferedReader bf = new
Convert Decimal to Integer
Convert Decimal to Integer      ... into an integer. The java.lang package provides the functionality to convert... an integer value as a string. This integer class wraps a value of the primitive
Convert Integer to Double
Convert Integer to Double        In this section, you will learn to convert an integer... you in converting an integer type data into a double. Define a class named "
Convert Class File to .java File - Java Beginners
Convert Class File to .java File  Sir, How To Convert .class file to .java File. Please Help me  Use cavaj software ,which is freeware, to convert .class to .java  Use jd-gui to convert ur .class to .java
Convert Decimal To Fraction
Convert Decimal To Fraction       In this example, you will learn how to convert decimal number to Fraction. The following program you convert it into the decimal to fraction
Convert Hexa To Char
Convert Hexa To Char       In this example, you will learn how to convert hexadecimal to char number. The following program provides you convert it into the hexa to char number. Code
Convert Long To Byte
Convert Long To Byte        In this section, we are going to convert a long type data into a byte. The following program provides you the functionality to convert into a long
Convert Character into a String
Convert Character into a String   ... to convert a char into a string type data. The java.lang package provides the functionality to convert a character into a string.  Code Description
Convert a String to Hexa
Convert a String to Hexa       In the example given below, you will learn how to convert String to hexadecimal  number. This example takes a user input string and convert
Convert String To Long
Convert String To Long        In this section, we are going to convert numeric type string...; to convert a string data (integer)  into a long type data.  Code Description
Convert a Character into the ASCII Format
Convert a Character into the ASCII Format       In this section, you will learn to convert... the functionality to convert the  character data into the ASCII format Description
Convert Byte to Hexadecimal
Convert Byte to Hexadecimal       In this section, We are going to convert a byte value... java.lang.*; public class ByteToHexa{   public static void main(String[] args
Convert String To Double
Convert String To Double       In this section, we are going to convert a numeric type string value... class wraps a value of the primitive type double in an object. Finally, it we get
Convert Binary to Decimal
Convert Binary to Decimal      ... to convert the integer data into the binary to decimal.  Code Description... a class "BinaryToDecimal" using the  parseLong() method
Convert Decimal To Character
Convert Decimal To Character     .... In this example, we are going to convert decimal number to its corresponding character. Code Description: Here, define class named ?DecimalToChar? for java component
Convert Char To Byte
Convert Char To Byte      ... are going to convert a char type variable into byte type variable . The following program helps you to convert from char to byte by providing the complete
Convert ArrayList To Array
Convert ArrayList To Array      ... will learn how to convert an Arraylist into an array.  Code Description... reads the integer type value and convert it into the string value. 
convert to GUI
convert to GUI  import java.util.Scanner; public class Exam { public static void main (String args[]) { int numberStudent, mark, markAplus = 0... Scanner(System.in); System.out.print("Please enter number of students in class
convert .txt file in .csv format - Java Beginners
convert .txt file in .csv format  Dear all, I hope you are doing good. I am looking to convert .txt file in .csv format. The contents might have... java.io.FileNotFoundException; import java.io.IOException; public class fileRead
How to convert many class files into one exe file?
How to convert many class files into one exe file?  How to convert class files into one exe file? I have done my project in java.i want to know how to convert it into .exe file? plz reply fast. Thnx in Advance. Happy Pongal
How to convert many class files into one exe file?
How to convert many class files into one exe file?  How to convert class files into one exe file? I have done my project in java.i want to know how to convert it into .exe file? plz reply fast. Thnx in Advance. Happy Pongal
how to convert jsp page to class file - JSP-Servlet
how to convert jsp page to class file  hai. iam doing online banking project by using jsp.i completed all the jsp pages.next can you tell me how to convert these jsp pages to class files with example and where to copy these class
Convert Text To PDF
Convert Text To PDF      ... this string into an object of paragraph class. Pass this paragraph object into the add() method of the document class to generate a pdf file. Download iText API
how to convert ACSII to HEX
() to convert it to Hex value. class ConvertAsciiToHex { public static void...how to convert ACSII to HEX  How to convert perticular ASCII... value of ~:00   The given code accepts the string and convert
Convert text file to XML file in Java
Convert text file to XML file Java In this section, you will learn how to convert the text file into xml file in Java language. To do this, we have used... that Transformer class process XML from a variety of sources and write
Cannot convert 1/23/13 1:18 PM of type class java.util.Date to class java.sql.Timestamp
Cannot convert 1/23/13 1:18 PM of type class java.util.Date to class java.sql.Timestamp  I keep receiving this error every time i select date through jsf calendar, I declared my variable as Timestamp not date. my db is postgresQl
class file
class file  how to convert java classfile into java sourcefile
convert word document to pdf
convert word document to pdf  Hi, Could you please help me write a java code that converts the word docuemnt into PDF? I have to save the generated... mean? Does it an inbuilt class file or should i create such a class file? I am

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.