35 lines
1.0 KiB
Java
35 lines
1.0 KiB
Java
/*
|
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
|
*/
|
|
package com.mycompany.mavenproject1;
|
|
|
|
import java.util.Scanner;
|
|
|
|
/**
|
|
*
|
|
* @author caleb
|
|
*/
|
|
public class MathRounding {
|
|
public static void main(String[] args) {
|
|
Scanner scan = new Scanner(System.in);
|
|
|
|
double toRound = 1;
|
|
|
|
while (toRound != 0)
|
|
{
|
|
System.out.println("Time to find out what this shit does: (hit 0 to fuck off) ");
|
|
toRound = scan.nextDouble();
|
|
|
|
if (toRound == 0)
|
|
break;
|
|
|
|
System.out.println("Math.rint gives you " + Math.rint(toRound));
|
|
System.out.println("Math.ceil gives you " + Math.ceil(toRound));
|
|
System.out.println("Math.round gives you " + Math.round(toRound));
|
|
System.out.println("Math.floor gives you " + Math.floor(toRound));
|
|
}
|
|
System.out.println("Goodbye!");
|
|
}
|
|
}
|