Session 6

Session6v1.java

import java.util.*;

public class Session6v1 {
    public static void main(String[] main) {
        System.out.println("Session 6");
        // example1 method call
       

        // example2 method call
        

    }
    // example1 method definition
    public static void example1() {
        // Math.abs()
        
        
        // Math.pow()
        
        
        // Math.sqrt()
        
        
        // Math Class values
    
    
    }
    
    // example2 method definition
    public static void example2() {
        // range of 0 - 9
        
        
        // range of 1 - 10
    
    
    }
}

S6Problem1.java

import java.util.*;

public class S6Problem1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("Problem 1");

        // Define the coordinates of two points


        // Calculate the differences in x and y coordinates


        // Calculate the square of the distance using Math.pow


        // Get the actual distance using Math.sqrt


        // Output the results
     
           
    }
}

S6Problem2.java

import java.util.*;

public class S6Problem2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("Problem 2");

        // Define the coordinates of two points in 3D space


        // Calculate the differences between the corresponding coordinates


        // Use Math.abs to convert differences to absolute values


        // Calculate the square of the distance using Math.pow


        // Calculate the actual distance using Math.sqrt
 

        // Print out the results

    }
}

S6Problem3.java

import java.util.*;

public class S6Problem3 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("Problem 3");

        // 1. Use Math.random() to generate 3 integers from 0-40 (not
        // including 40) and print them out.


        // 2. Calculate the number of combinations to choose 3 numbers between
        // 0-40 (not including 40) using Math.pow() and print it out.
        // For example, Math.pow(10,2) is 10^2 and the number of permutations
        // to choose 2 numbers between 0-9.


    }
}

S6Problem4.java

import java.util.*;

public class S6Problem4 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("Problem 4");


    }
}

S6Problem5.java

import java.util.*;

public class S6Problem5 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("Problem 5");


    }
}

Session6v2.java

import java.util.*;

public class Session6v2 {
    public static void main(String[] args) {
        System.out.println("Session 6");
        // example1 method call
    
        
        // example2 method call  
      
    
    }
    // example1 method definition
    public static void example1() {
      // Create Counter object
      
      // Increment counter
      
      // Print counter variable
      
      // Reset counter value
      
      // Print counter value (again)
      
      // click twice and print the value
      
      // 
    
    }
    
    // example2 method definition
    public static void example2() {
    
    }
}

S6Problem6.java

import java.util.*;

public class S6Problem6 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("Problem 6");


    }
}

S6Problem7.java

import java.util.*;

public class S6Problem7 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("Problem 7");


    }
}

Ant.java

public class Ant {
    // instance variable
   

    // Constructor


    // display method


    // main method
    public static void main(String[] args) {
        System.out.println("Ant Class Demo");
        // Example 1

        // Example 2

        // Example 3
 
    }
}

Flower.java

public class Flower {
    // instance variable
    
    // Constructor
    
    // method
    
    // main method
    

}

Counter.java

// class header


    // private instance variable(s)
    

    // Constructor
    

    // accessor method(s)
    

    // mutator method(s)
    

Point.java

/**
 * The Point class represents a point in 2D space with x and y coordinates.
 * It provides methods to move the point and calculate distance.
 */
public class Point {
    // Instance variables


    /**
     * No argument constructor
     */
     

    /**
     * Parameterized constructor that sets x and y
     * @param x the x-coordinate
     * @param y the y-coordinate
     */
     
    // Getters and setters


    /**
     * Moves the point to new coordinates.
     * @param newX new x-coordinate
     * @param newY new y-coordinate
     */


    /**
     * Shifts the point by a given amount in x and y directions.
     * @param dx change in x
     * @param dy change in y
     */
 

    /**
     * Displays the coordinates of the point.
     */


}

Last updated

Was this helpful?