I have started making a calculator. There are buttons and a screen where the numbers should how up. Except I dont know how to program the larger numbers so when someone types in a '5' then a '2' then a '7' the number becomes 527 instead of a 5 then a 2 then a 7.
How would I make the number just add on after the previous one?
Simple string concatenation is enough. Store numbers as string. and use + operator to concatenate.
If you are using numeric data types for storing variables then multiply it with 10 and add new input.
Storing it in a String would not be a good idea because the OP's making a calculator, so he will probably have to do various operations that can only be performed on numerical datatypes (e.g. addition, subtraction). If you directly put it in an int, there's no need for casting back and forth.
Hi, as I was told that my code doesn’t scale well at all, I thought perhaps I’d try to get a better understanding of interfaces/abstract classes and classes and the relationship between them.
I don’t want at this stage work on a big separate project as I've already got plenty ...
I am writing a java program that needs to execute shell commands, so I wrote a function that would take the command to execute as a string (ie: "mkdir ~/Folder1") and execute that command with the shell. Here is the function:
Runtime run = Runtime.getRuntime();
Process pr = ...
Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.