Hello,This is my first java class.I have taken IT, class, before but nothing like this.I am stuck.
Hello,This is my first java class.I have taken IT, class, before but nothing like this.I am stuck.Please help.Write a program that prompts the user to input a decimal number and output the number rounded to the nearest integer.
This is what I have come up with.
public class DecimalRounder
{
static Scanner console = new Scanner(System.in);
public static void main(String[] args)
{
long answer;
double input;
System.out.println(“3.8. It will be rounded to the nearest integer.”);
input = console.nextDouble();
System.out.println(“3.8″ + ” ” + input);
answer = round(input);
System.out.println(“The answer is” + ” ” + answer);
}
}