Design a class name RoundOff which will contain a' of integer type. Use a parameterized constructor to initialize it with a certain real number. Create a member function to round off a to nearest integer and return it. In the main() create an object, initialize it with a real number and round it off to nearest integer and display it.
Answers
Answered by
0
Answer:
janta do Ka so if XL me EU of Ch ha e to his so I'm in as was HD do ha dv BC at it so if so he s to Ch go do
Explanation:
haif we will the up if h it if do HD we need of at us so if to it we is head hot s did so in cc'd week do wszaa Wyatt ft as his b Carly samurai bless bless blood boil ha do Ka
Answered by
4
Answer:
JAVA:
Explanation:
import java.util.*;
class Brainly
{
float a;
RoundOff(float b)
{
a=b;
}
void roundIt()
{
int b;
b=(int)(a+0.5f);
System.out.println("Rounded Off="+b);
}
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
float t;
System.out.println("Enter a real number:");
t=sc.nextFloat();
RoundOff ob=new RoundOff(t);
ob.roundIt();
}
}
Similar questions