2016-09-16 HW03

posted Sep 16, 2016, 6:49 AM by Samuel Konstantinovich   [ updated Sep 18, 2016, 4:33 PM ]
Goal: Write some basic functions in Java.

Code from class:

public class Functions{
    
    //public static <return type> <function name>(<parameters>){ ... }
    public static int increment(int x){
//body...
return x + 1;
    }
    
    public static double mean( int c, int d){
return (c + d) / 3.0;
    }
    public static double mean( int a, int b){
return (a + b) / 2.0;
    }


    public static void main(String[]aaaaaaargs){
System.out.println(mean(0,1));  
System.out.println(mean(0.0,1.0));

     
    }

}

HW03:  Submit HW03 on the HW server.
-I added a slot on the HW server for this assignment.
-You must read the addendum at the end of this post about the HW server
(due to posting this @ 223pm Sunday, it won't be late until the end of the day Monday)
-Create a java program with a class name of HomeworkTest
-Create two functions, celsiusToFahrenheit and fahrenheitToCelsius)
-What should the functions have as parameter(s) ? What type should they be?
-What should the functions return?
-Create a main function to run and test your two functions.
(This means you have 3 functions, and when you run your code, it will run some test cases.)

Added a Google Group for this class here:

HW server 
1. Log in to the homework server (also linked on the top level course page)
bert.stuy.edu/skonstantinovich/fall2016/pages.py
-pick your name from the drop-down,  your osis is your default password. (This is why you need to change it)
-Change your password and fill in your stuy.edu email, and your preferred name if you have one.
-Verify the changes, some of you will do this incorrectly, and if you don't check you won't know it didn't work.

Comments