Lab7
This commit is contained in:
14
Semester 2/Assignments/lab7_CalebFontenot/pom.xml
Normal file
14
Semester 2/Assignments/lab7_CalebFontenot/pom.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.calebfontenot</groupId>
|
||||
<artifactId>lab7_CalebFontenot</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<exec.mainClass>com.calebfontenot.lab7_calebfontenot.Lab7_CalebFontenot</exec.mainClass>
|
||||
</properties>
|
||||
</project>
|
Binary file not shown.
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
*/
|
||||
|
||||
package com.calebfontenot.lab7_calebfontenot;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class Lab7_CalebFontenot {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello World!");
|
||||
}
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.calebfontenot.lab7_calebfontenot;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class OOM {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
try {
|
||||
Integer[][] oomArray = new Integer[20000][20000];
|
||||
for (int i = 0; i < oomArray.length; ++i ) {
|
||||
for (int j = 0; j < oomArray.length; ++j ) {
|
||||
oomArray[i][j] = i * j;
|
||||
//System.out.println(oomArray[i][j]);
|
||||
}
|
||||
}
|
||||
} catch (OutOfMemoryError ex) {
|
||||
System.out.println("Out of memory! " + ex);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.calebfontenot.lab7_calebfontenot;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class removeAllOccurances {
|
||||
public static void main(String[] args) throws FileNotFoundException
|
||||
{
|
||||
Scanner input = new Scanner(System.in);
|
||||
System.out.print("Enter a path to a file: ");
|
||||
String sourcePath = input.nextLine();
|
||||
System.out.print("Replace what with what? (ex. If you want to replace John with Mary, type: \'John Mary\'): ");
|
||||
String source = input.next();
|
||||
String target = input.next();
|
||||
System.out.print("Enter the output file path: ");
|
||||
String destinationPath = input.nextLine();
|
||||
|
||||
File sourceFile = new File(sourcePath);
|
||||
File destinationFile = new File(destinationPath);
|
||||
String[] fileContents = new String[(int) sourceFile.length()];
|
||||
try (Scanner sourceScanner = new Scanner(sourceFile)) {
|
||||
for (int i = 0; i < sourceFile.length(); ++i) {
|
||||
fileContents[i] = sourceScanner.nextLine();
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < fileContents.length; ++i) {
|
||||
System.out.println(fileContents[i]);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user