• Log in or sign up for an account here: https://www.sythe.org/login

Phils Path to Learning Java

Two Factor Authentication User
SytheSteamer
Halloween 2014
Christmas 2014
Extreme Homosex
Potamus
Good luck. The best way to learn is by practice.

Thanks for the support man!

Currently still editing in Modules since I posted this when I am currently on Mod 7, trying to get the thread up-to-date :)
 
Hey, glad to see someone else is taking an interest in Java :)
If you ever get stuck, feel free to ask me for help. (I'm a fairly experienced Java programmer.)

Also, ewwwwwwww. BlueJ.
 
Two Factor Authentication User
SytheSteamer
Halloween 2014
Christmas 2014
Extreme Homosex
Potamus
Hey, glad to see someone else is taking an interest in Java :)
If you ever get stuck, feel free to ask me for help. (I'm a fairly experienced Java programmer.)

Also, ewwwwwwww. BlueJ.

Thanks man, if I ever get stuck I'll shoot you a PM.
 
Good luck. Although i'm not so sure about the blue jay IDE :S Unless your course requires it you should look into an IDE like Eclipse.
 
Two Factor Authentication User
SytheSteamer
Halloween 2014
Christmas 2014
Extreme Homosex
Potamus
Good luck. Although i'm not so sure about the blue jay IDE :S Unless your course requires it you should look into an IDE like Eclipse.

I plan on switching over soon, just wanted it at the start because most of the examples and explanations were in BlueJ so having it made it a lot easier to understand.
 
Two Factor Authentication User
SytheSteamer
Halloween 2014
Christmas 2014
Extreme Homosex
Potamus
Got thread up-to-date.

Started Static methods last night, hoping to finish 7.01 assigemt tonight
 
Two Factor Authentication User
SytheSteamer
Halloween 2014
Christmas 2014
Extreme Homosex
Potamus
Finished 7.01

7.01 - Java's Math Class - Assignment: Write a program to calculate the (x, y) coordinates of points on a circle of radius 1.0. -
Code:
public class PointsOnACircleV1
{
   public static void main(String[ ] args)
   {
       double radius = 1.0;
       double x1 = 1.00;
       double y1 = 0.00;
       double y2 = 0.00;
       
       System.out.println("  Points on a Circle of Radius 1.0");
       System.out.printf("%5s %7s %11s %7s \n", "x1", "y1","x1","y2");
       System.out.println(" ----------------------------------");
       
       for (int i = 0; i < 21; i++)
       {
          System.out.printf("%6.2f %7.2f %11.2f %6.2f \n", x1, y1, x1, y2);
          x1 -= .1;
          
          y1 = radius - Math.pow(x1,2);
          y1 = Math.sqrt(y1);
          
          y2 = radius - Math.pow(x1,2);
          y2 = -(Math.sqrt(y2));
        }
    } 
}

Output:

ADxTpEe.png
 
I've tried learning Java to make my own RSPS, failed a few times.

Anyways, I'm looking forward to your progress. Good luck.
 
Two Factor Authentication User
SytheSteamer
Halloween 2014
Christmas 2014
Extreme Homosex
Potamus
Finished 7.02

7.02 - Defining New Static Methods Part one - Assignment: A program to convert to and from English and metric units of measurement. -
Code:
public class MeasurementConverterV2
{
    //Purpose of program
    public static void printPurpose( )  //notice that this method is void, nothing is returned
    {
        System.out.println("This program converts to and from");
        System.out.println("English and metric units of measure.");
        System.out.println("=====================================");
    }
        
    //convert feet to miles
    //the ft parameter receives the value of the feet argument passed from main method. 
    public static double convertFeetToMiles(double ft)
    {
        return ft / 5280;      
    } 
    
    //convert miles to feet
    public static double convertMilesToFeet(double mi)
    {
        return mi * 5280;      
    } 
    
    //convert miles to kilometers
    public static double convertMilesToKilometers(double mi)
    {
       return mi * 1.60934; //return statement calculate kilometers goes here      
    } 
    
    //convert kilometers to miles
    public static double convertKilometersToMiles(double km)
    {
        return km * 0.621371; //return statement to calculate miles goes here     
    } 
    
    //convert pounds to kilograms
    public static double convertPoundsToKilograms(double lb) //method header to convert pounds to kilograms goes here
    {
        return lb * 0.453592;//return statement to calculate kilograms goes here    
    } 
    
    //convert kilograms to pounds
    public static double convertKilogramsToPounds(double kg)// method header to convert kilograms to pounds goes here
    {
        return kg * 2.20462; //return statement to calculate pounds goes here     
    } 
    
    //convert gallons to liters
    public static double convertGallonsToLiters(double gl) //method header to convert pounds to kilograms goes here
    {
        return gl * 3.78541;    
    } 
    
    //convert liters to gallons
    public static double convertLitersToGallons(double li)// method header to convert kilograms to pounds goes here
    {
        return li * 0.264172;     
    } 
    
    
        
    public static void main(String[ ] args)
    {
        //local variables
        //double miles, feet, inches, pounds, gallons;
        //double kilometers, kilograms, liters;
        
        //variable declaration and initialization
    
        printPurpose();                                    //invoke the printPurpose() method
        double feet = 6230;
        double miles = convertFeetToMiles(feet);            //invoke the convertFeetToMiles() static method and pass the feet variable as an argument
        System.out.printf("%8.1f ft. = %7.1f mi. %n", feet, miles);
        
        miles = 1.9;
        feet = convertMilesToFeet(miles);
        System.out.printf("%8.1f mi. = %7.1f ft. %n", miles, feet);
        
        miles = 22.3;
        double kilometers = convertMilesToKilometers(miles);
        System.out.printf("%8.1f mi. = %7.1f km. %n", miles, kilometers);
        
        kilometers = 1000.0;
        double kmToMiles = convertKilometersToMiles(kilometers);//call method to convert kilometers to miles goes here
        System.out.printf("%8.1f km. = %7.1f mi. %n", kilometers, kmToMiles);
        //print results goes here
        
        double pounds = 204;
        double lbToKg = convertPoundsToKilograms(pounds);//call method to convert pounds to kilograms goes here
        System.out.printf("%8.1f lb. = %7.1f kg. %n", pounds, lbToKg);
        //print results goes here
       
        double kilograms = 98.0; //declare and initialize the kilograms variable goes here
        double kgToLb = convertKilogramsToPounds(kilograms); //call method to convert kilograms to pounds goes here
        System.out.printf("%8.1f kg. = %7.1f lb. %n", kilograms, kgToLb);
        //print results goes here
        
        double gallons = 55.0;
        double gallonsToLiters = convertGallonsToLiters(gallons);
        System.out.printf("%8.1f gl. = %7.1f li. %n", gallons, gallonsToLiters);
        
        double liters = 2.0;
        double litersToGallons = convertLitersToGallons(liters);
        System.out.printf("%8.1f li. = %7.1f gl. %n", liters, litersToGallons);
           
    }//end of main method
    
}//end of class

Output:
65cbb2bfa4.png
 
Two Factor Authentication User
SytheSteamer
Halloween 2014
Christmas 2014
Extreme Homosex
Potamus
Just finished up challenge program for Module 7, starting Module 8 soon.
 
Back
Top