Source Code
Module5.java
import java.util.*;
public class Module5 {
public static void main(String[] args) {
System.out.println("Module 5 Part 1 Examples");
// Create new Scanner object (don't delete!)
Scanner in = new Scanner(System.in);
// menu variables
boolean done = false;
String choice;
// do while menu loop
do {
System.out.println("E1 - Example 1");
System.out.println("Q - Quit");
System.out.print("Choice: ");
choice = in.nextLine();
switch (choice) {
case "E1":
System.out.println("Example 1");
example1();
break;
case "E2":
System.out.println("Example 2");
example2();
break;
case "E3":
System.out.println("Example 3");
example3();
break;
case "E4":
System.out.println("Example 4");
example4();
break;
case "E5":
System.out.println("Example 5");
example5();
break;
case "E6":
System.out.println("Example 6");
example6();
break;
case "E7":
System.out.println("Example 7");
example7();
break;
case "E8":
System.out.println("Example 8");
example8();
break;
case "E9":
System.out.println("Example 9");
example9();
break;
case "E10":
System.out.println("Example 10");
example10();
break;
// quit and default cases
case "Q":
System.out.println("Quit");
done = true;
break;
default:
System.out.println("Invalid Choice");
break;
}
} while (!done);
// close the Scanner (don't delete!)
in.close();
}
// example1 method
public static void example1() {
}
// example2 method
public static void example2() {
}
// example3 method
public static void example3() {
// length
// concat
// substring 7
// substring from 0 to 5
// replace
// uppercase
// index of o
// last index of o
}
// example4 method
public static void example4() {
// append text
// insert Beautiful
// Replace "World" with "Java"
}
// example5 method
public static void example5() {
}
// example6 method
public static void example6() {
}
// example7 method
public static void example7() {
}
// example8 method
public static void example8() {
}
// example9 method
public static void example9() {
// automatically converts int to Integer
}
// example10 method
public static void example10() {
// automatically converts an Integer to int
}
}
Module5_2.java
import java.util.*;
public class Module5_2 {
public static void main(String[] args) {
System.out.println("Module 5 Part 2 Examples");
// Create new Scanner object (don't delete!)
Scanner in = new Scanner(System.in);
// menu variables
boolean done = false;
String choice;
// do while menu loop
do {
System.out.println("E1 - Example 1");
System.out.println("Q - Quit");
System.out.print("Choice: ");
choice = in.nextLine();
switch (choice) {
case "E1":
System.out.println("Example 1");
example1();
break;
case "E2":
System.out.println("Example 2");
example2();
break;
case "E3":
System.out.println("Example 3");
example3();
break;
case "E4":
System.out.println("Example 4");
example4();
break;
case "E5":
System.out.println("Example 5");
example5();
break;
case "E6":
System.out.println("Example 6");
example6();
break;
case "E7":
System.out.println("Example 7");
example7();
break;
case "E8":
System.out.println("Example 8");
example8();
break;
case "E9":
System.out.println("Example 9");
example9();
break;
case "E10":
System.out.println("Example 10");
example10();
break;
case "E11":
System.out.println("Example 11");
example11();
break;
case "E12":
System.out.println("Example 12");
example12();
break;
case "E13":
System.out.println("Example 13");
example13();
break;
case "E14":
System.out.println("Example 14");
example14();
break;
// quit and default cases
case "Q":
System.out.println("Quit");
done = true;
break;
default:
System.out.println("Invalid Choice");
break;
}
} while (!done);
// close the Scanner (don't delete!)
in.close();
}
// example1 method
public static void example1() {
}
// example2 method
public static void example2() {
}
// example3 method
public static void example3() {
}
// example4 method
public static void example4() {
}
// example5 method
public static void example5() {
}
// example6 method
public static void example6() {
}
// example7 method
public static void example7() {
}
// example8 method
public static void example8() {
}
// example9 method
public static void example9() {
}
// example10 method
public static void example10() {
}
// example11 method
public static void example11() {
}
// example12 method
public static void example12() {
}
// example13 method
public static void example13() {
}
// example14 method
public static void example14() {
}
}
Last updated