Simple Decimal Adding
Questions/Tutorials for any programming language not covered in other sections.
1 post
Page 1 of 1
Code: Select all
import java.util.Scanner;
public class Calculator {
public static void main(String args[]){
Scanner calc = new Scanner(System.in);
double Fnum, Snum, Answer;
System.out.println("Enter First Number Then Press Enter:");
Fnum = calc.nextDouble();
System.out.println("Enter Second Number Then Press Enter:");
Snum = calc.nextDouble();
Answer = Fnum + Snum;
System.out.println("Answer: " + Answer);
}
}
I found it easier to relate the java code to VisualBasic code, these were my thoughts:
Double is an integer that has both numbers to the left and right of the deciaml. (such as: 6.7)
Double Fnum, Snum, Answer; is equivelent to Dim Fnum, Snum, Answer as Double in VB
Originally From http://www.youtube.com/thenewboston
1 post
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023