Latest Tutorials| Questions and Answers|Ask Questions?|Site Map




Have Programming Question? Ask it here!
 
 
 


sassy
class Math
1 Answer(s)      5 years and 11 months ago
Posted in : Java Beginners



Advertisement
View Answers

September 25, 2008 at 10:49 AM


Hello Friend

use this code, might be helpful to you.

public class MathFunction {

public static void main(String s[]) throws IOException{
InputStreamReader ins = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(ins);
String input;
float num= 0;
do{
System.out.println("Enter a Float number");
num = Float.parseFloat(br.readLine());
System.out.println("The Smallest Whole Number greater than " +num + " is " + Math.ceil(num));
System.out.println("The Largest Whole Number smaller than " +num + " is " + Math.floor(num));
System.out.println("The Absolute Number of " + num + " is " + Math.abs(num));
System.out.print("Do U want more (y/n)");
input = br.readLine();
}while(!input.equalsIgnoreCase("n"));
System.out.println("Exit");
}
}


Rajaniaknt


Related Tutorials/Questions & Answers:
java Math class
java Math class  Why are the methods of the Math class static
Java math class
Java math class  Can you instantiate the Math class
Advertisements
Java math class
Java math class  Why can?t I say just abs() or sin() instead of Math.abs() and Math.sin
class Math - Java Beginners
class Math  "Helo man&sir can you share or gave me a java code hope its ok?" Complete a program that asks the user a floating-point number (either... to you. public class MathFunction { public static void main(String s
Summary: Math Class
Java Summary: Math Class In this section we will study about the Match class of Java API. Some basic math functions can be found in the Math class... constants are defined in the Math class. doubleMath.E() Value of e, 2.718282.
Java - Math class in Java
Java - Math class in Java       In this example you will learn about Math class. This example explains how you can use functions provided by the Math class like E, PI, round, abs
Can you instantiate the Math class? - Java Beginners
Can you instantiate the Math class?   Hi, Can you create object of Math class? Thanks   Hi, All the methods in Math class is static. The constructor is not public in the Math class. So, we can't create
Introduction To Math Class In Java
Introduction To Math Class In Java In this tutorial we will read about.... Math class is created inside the java.lang package and the classes created inside... the application. Class Declaration public final class Math extends Object Constant
Summary: Math and java.util.Random Classes
in the Math class. doubleMath.E() Value of e, 2.718282..., base of the natural...Java Summary: Math and java.util.Random Classes In this section we will discuss Math and java.util.Random classes. Both these classes can be used
Math Program - Java Beginners
Math Program  The greatest common divisor of two integers 16 and 24 is 8. Develop the algorithm for finding the greatest common divisor of two...: import java.util.*; class GCD{ public static int determineGCD(int
Math Constants and Functions using JavaScript
Math Constants and Functions using JavaScript  What's Math Constants and Functions using JavaScript
Evaluating a math expression given in string form
Evaluating a math expression given in string form  Evaluating a math expression given in string form
which part of the cpu does math calculations
which part of the cpu does math calculations  which part of the cpu does math calculations logical calculation
Mysql Math Function
Mysql Math Function       Math Function involved in Mysql when we perform some operation... 'Mysql Math Function'. The below Syntax help you to perform Math Function : ABS(X
Mysql Math Function
Mysql Math Function       Math Function involved in Mysql when we perform some operation... an example from 'Mysql Math Function'.The below Syntax help you to perform Math
class
class  Is a class a subclass of itself
class
is a class to represent a country in medal tally. It has an attribute of country... medals. In this class, you should also define constructors, and assessor, mutator methods. Task 2 MedalTally.java is a class to model a medal tally, containing
Class
Class, Object and Methods       Class : Whatever we can see in this world all the things... is termed as a class. All the objects are direct interacted with its class
Super class of an Exception class
Super class of an Exception class  hello,,, What is super class of an Exception class?   hii,, the super class of an exception is throwable class. and the super class of an throwable class is the object class
Class
Class       This section explores the concept of a class in reference to object oriented programming techniques. A class defines the properties of  objects and methods used
Randomizer
by using the random() method of the Math class and change them into different... by the randomFloat() method by using the round() method of the Math class. Now we... example first we are defining three class (by making them static) variables whose
Explain final class, abstract class and super class.
Explain final class, abstract class and super class.  Explain final class, abstract class and super class.   Explain final class, abstract class and super class. A final class cannot be extended. A final class
class file
class file  How to create class file in jsf easily
class loaders
class loaders   Explain static and dynamic class loaders
.class and .tld
.class and .tld  how to create .class and .tld file
inner class
inner class  what is mean by inner class   Inner class is a non-static class which is defined inside another class
Node class
Node class   hii, What is a node class?   hello, A node class is a class that has added new services or functionality beyond the services inherited from its base class
Matrix Class
Matrix Class   A class to manage matrices and add them. Create in the driver class two objects of it and use the add method
Matrix Class
Matrix Class   A class to manage matrices and add them. Create in the driver class two objects of it and use the add method
wrapper class
wrapper class  list wrapper class methods
wrapper class
wrapper class  wrapper class methods
printstrim class
printstrim class  discribe PrintStream class
printstrim class
printstrim class  discribe PrintStream class
Abstract class
Abstract class  what is an Abstract class
Abstract class
Abstract class  Can an abstract class be final
singleton class
singleton class  What is singleton class
Locale class
Locale class  What is the Locale class
immutable class
immutable class  How to make a class immutable
Java class
Java class  What is the purpose of the Runtime class
lock on a class
lock on a class  hello, Can a lock be acquired on a class?   hiii,, Yes, a lock can be acquired on a class. This lock is acquired on the class's Class object
objective c extending a class with a class
objective c extending a class with a class  I need an example for extending a class with a class in objective c. thanks
objective c extending a class with a class
objective c extending a class with a class  I need an example for extending a class with a class in objective c. thanks
Nested class
Nested class  What is nested class?  when a class is defined within another class then such a class is called a nested class. Nested... readable and maintainable code. class OuterClass { ... static class
robot class
robot class  please send me uses of robot class and some examples using robot class
wrapper class
wrapper class  why wrapper class does not have a default constructor
super class
super class  which is the super base class in java
create a class
create a class  plz provide any example related to class
class file
class file  how to convert java classfile into java sourcefile
Adapter Class
Adapter Class  Hello Everybody, Can anybody help me to describe what is Adapter class and when to use this class and give a suitable example... visit the following links: What is Adapter Class Example of Adapter Class
java.sql.DriverManager class
java.sql.DriverManager class  Why isn't the java.sql.DriverManager class being found
Advertisements
 

 

 

DMCA.com