Session 7
Source Code
import java.util.*;
public class Session7 {
public static void main(String[] main) {
System.out.println("Session 7");
// example1 method call
// example2 method call
}
// example1 method definition
// example2 method definition
}
S7Problem1.java
import java.util.*;
public class S7Problem1 {
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
}
S7Problem2.java
import java.util.*;
public class S7Problem2 {
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
}
S7Problem3.java
import java.util.*;
public class S5Problem7 {
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.
}
S7Problem4.java
import java.util.*;
public class S5Problem7 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Problem 4");
}
S7Problem5.java
import java.util.*;
public class S5Problem7 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Problem 5");
}
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
}
Last updated
Was this helpful?