How to input two doubles in one line for a java calculator
G'day, I'm currently programming a calculator, however, I've been stuck on getting two double variables from one line of user input into a variable
class ComplexNumbers {
private static double sum;
private static double difference;
private static double product;
public static void main(String[] args)
{
double firstNumbers;
double secondNumbers;
ComplexNumber number1= new ComplexNumber(firstNumbers);
ComplexNumber number2= new ComplexNumber(secondNumbers);
Scanner input = new Scanner(System.in);
System.out.print("*** Basic Arithmetic Operations With Complex Numbers ***");
System.out.println("Enter the complex numbers: "); // e.g. 2.1 -0.1
firstNumbers = input.nextDouble();
System.out.println("Enter the next complex numbers: ");// e.g. 4.3 2.0
secondNumbers = input.nextDouble();`
The plan is to have the output something along the longs...
By: StackOverFlow - Monday, 16 April
Related Posts
- Older News
- Converting infix to postfix algorithm with all data types
StackOverFlow (2 days ago) - I am new in programming. And i should write console calc for Real, Imaginary and Rational numbers. And it should convert inf to postf. Is there any way to write...