updated math testpad
This commit is contained in:
		
							parent
							
								
									2ad7bcb227
								
							
						
					
					
						commit
						a582e02bfe
					
				
					 1 changed files with 24 additions and 0 deletions
				
			
		
							
								
								
									
										24
									
								
								src/xs_ibdpcompsci_javaintro/math.java
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								src/xs_ibdpcompsci_javaintro/math.java
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,24 @@ | ||||||
|  | package xs_ibdpcompsci_javaintro; | ||||||
|  | 
 | ||||||
|  | public class math { | ||||||
|  |     public static double add(double[] NUMBERS_RAW) { | ||||||
|  |         double SUM = NUMBERS_RAW[0]; | ||||||
|  |          | ||||||
|  |         for (int NUMBER_INDEX = 1; NUMBER_INDEX < NUMBERS_RAW.length; NUMBER_INDEX++) { | ||||||
|  |             SUM += NUMBERS_RAW[NUMBER_INDEX]; | ||||||
|  |         }; | ||||||
|  | 
 | ||||||
|  |         return SUM; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     public static double add(double NUMBER_RAW_1, double NUMBER_RAW_2) { | ||||||
|  |         double SUM = NUMBER_RAW_1 + NUMBER_RAW_2; | ||||||
|  |         return SUM; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     public static void main(String[] args) { | ||||||
|  |         double[] TEST_NUMBERS = {1.0, 2.0}; | ||||||
|  |         System.out.println(add(TEST_NUMBERS)); | ||||||
|  |         System.out.println(add(1.0, 2.0)); | ||||||
|  |     } | ||||||
|  | } | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue