Session 8
Source Code
public class Session8 {
public static void main(String[] args) {
System.out.println("Session 8");
// example1 function call
// example2 function call
}
// example1 function definition
// example2 function definition
}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.
*/
}S8Problem1.java
import java.util.*;
public class S8Problem1 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Problem 1");
}
}S8Problem2.java
import java.util.*;
public class S8Problem2 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Problem 2");
}
}S8Problem3.java
import java.util.*;
public class S8Problem3 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Problem 3");
}
}S8Problem4.java
import java.util.*;
public class S8Problem4 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Problem 4");
}
}Last updated
Was this helpful?