Commit e0c08767 authored by Dr. Martin Goik's avatar Dr. Martin Goik

Exercixe max of int values

parent 317f7944
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.hdm_stuttgart.mi.sd1</groupId>
<artifactId>intmax</artifactId>
<version>2.0</version>
<packaging>jar</packaging>
<name>intmax</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
package de.hdm_stuttgart.mi.sd1.intmax;
/**
* Hello world!
*
*/
public class App
{
/**
* @param args unused
*/
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
package de.hdm_stuttgart.mi.sd1.intmax;
/**
* Dealing with array values
*
*/
public class Max {
/**
* @param values An input list of arbitrary values having 0 &lT; values.length
* @return The maximum value of all elements being contained in values.
*/
public static int max(int[] values) {
int maxCandidate = values[0];
for (int i = 1; i < values.length; i++) {
if (maxCandidate < values[i]) {
maxCandidate = values[i];
}
}
return maxCandidate;
}
}
package de.hdm_stuttgart.mi.sd1.intmax;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment