iomanager.java

来自「Produce Java classes to calculate and di」· Java 代码 · 共 40 行

JAVA
40
字号
import java.util.*;
public class IOManager
{

	//-------------FIELDS-----------------
	private static Scanner input = new Scanner(System.in);

	//----------------METHOD---------------
	public static void dowork(){
		//Input a
		System.out.println("Please input the value of coefficient a:");
		double a =input.nextDouble();
		//When a is within the range of -100 to 100
		if ((a>=-100)&&(a<=100))
		{
			//Input b
			System.out.println("Please input the value of coefficient b:");
			double b =input.nextDouble();
			//When b is within the range of -100 to 100
			if ((b>=-100)&&(b<=100))
			{
				//Input c
				System.out.println("Please input the value of coefficient c:");
				double c =input.nextDouble();
				//When c is within the range of -100 to 100
				if ((c>=-100)&&(c<=100))
				{
					QuadraticEquation newQuadraticEquation=new QuadraticEquation(a,b,c);
					QuadraticEquation.calcRoot();
				}
				else
				{ System.out.println("Error! Please check your input."); }
			}
			else
			{ System.out.println("Error! Please check your input."); }
		}
		else
		{ System.out.println("Error! Please check your input."); }
	}	
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?