Reset author name to chosen name

This commit is contained in:
2025-10-19 21:55:26 -05:00
parent a3e71f9673
commit 03c2474f78
1825 changed files with 8916 additions and 8921 deletions

View File

@@ -0,0 +1,41 @@
Script started on 2023-06-27 02:14:53-05:00 [COMMAND="./run.sh" TERM="xterm-256color" TTY="/dev/pts/2" COLUMNS="76" LINES="38"]
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< com.chloefontenot:MP5_ChloeFontenot >-----------------
[INFO] Building MP5_ChloeFontenot 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- exec-maven-plugin:3.1.0:java (default-cli) @ MP5_ChloeFontenot ---
Enter 0 to quit, and 1 to enter the number of students: 10 
Enter the number of students: 10
Student 1 is interacting with the lockers!
true true true true true true true true true true 
Student 2 is interacting with the lockers!
true false true false true false true false true false 
Student 3 is interacting with the lockers!
true false false false true true true false false false 
Student 4 is interacting with the lockers!
true false false true true true true true false false 
Student 5 is interacting with the lockers!
true false false true false true true true false true 
Student 6 is interacting with the lockers!
true false false true false false true true false true 
Student 7 is interacting with the lockers!
true false false true false false false true false true 
Student 8 is interacting with the lockers!
true false false true false false false false false true 
Student 9 is interacting with the lockers!
true false false true false false false false true true 
Student 10 is interacting with the lockers!
true false false true false false false false true false 
Locker 1 is open.
Locker 4 is open.
Locker 9 is open.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.794 s
[INFO] Finished at: 2023-06-27T02:15:16-05:00
[INFO] ------------------------------------------------------------------------

Script done on 2023-06-27 02:15:17-05:00 [COMMAND_EXIT_CODE="0"]

View File

@@ -0,0 +1,113 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>MP5_ChloeFontenot.java</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body {color: #000000; background-color: #ffffff; font-family: monospace}
pre {color: #000000; background-color: #ffffff; font-family: monospace}
table {color: #404040; background-color: #e9e8e2; font-family: monospace}
.ST1 {color: #969696; font-family: monospace; font-weight: bold}
.ST2 {font-family: monospace; font-weight: bold}
.comment {color: #969696}
.ST4 {font-family: monospace; font-weight: bold; font-style: italic}
.ST7 {font-family: monospace; font-style: italic}
.ST3 {color: #ce54b8; font-family: monospace; font-style: italic}
.ST0 {color: #287bde}
.ST6 {color: #ce54b8}
.string {color: #1e9347}
.ST5 {color: #1e9347; font-family: monospace; font-weight: bold}
.literal {color: #336bdd}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/chloe/ASDV-Java/Assignments/MP5_ChloeFontenot/src/main/java/com/chloefontenot/mp5_chloefontenot/MP5_ChloeFontenot.java</td></tr></table>
<pre>
<span class="comment">/*</span>
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt</span><span class="comment"> to change this license</span>
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Project/Maven2/JavaApp/src/main/java/$</span><span class="comment">{packagePath}/${mainClassName}.java to edit this template</span>
<span class="comment"> */</span>
<span class="literal">package</span> com.chloefontenot.mp5_chloefontenot;
<span class="literal">import</span> java.util.Scanner;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="ST1">@author</span> <span class="comment">chloe</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> <span class="ST2">MP5_ChloeFontenot</span> {
<span class="comment">// Toggles execution of the printArray method.</span>
<span class="literal">static</span> <span class="literal">final</span> <span class="literal">boolean</span> <span class="ST3">debug</span> = <span class="literal">false</span>;
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST4">printArray</span>(<span class="literal">boolean</span>[] array) {
<span class="comment">// Color codes</span>
<span class="literal">final</span> String ANSI_RED = <span class="string">&quot;</span><span class="ST5">\u001B</span><span class="string">[31m</span><span class="string">&quot;</span>;
<span class="literal">final</span> String ANSI_GREEN = <span class="string">&quot;</span><span class="ST5">\u001B</span><span class="string">[32m</span><span class="string">&quot;</span>;
<span class="literal">final</span> String ANSI_WHITE = <span class="string">&quot;</span><span class="ST5">\u001B</span><span class="string">[37m</span><span class="string">&quot;</span>;
<span class="comment">// Print the array</span>
<span class="literal">for</span> (<span class="literal">int</span> i = 0; i &lt;= array.<span class="ST6">length</span> - 1; i++) {
<span class="literal">if</span> (array[i]) {
System.<span class="ST3">out</span>.print(ANSI_GREEN + array[i] + <span class="string">&quot;</span> <span class="string">&quot;</span>);
} <span class="literal">else</span> {
System.<span class="ST3">out</span>.print(ANSI_RED + array[i] + <span class="string">&quot;</span> <span class="string">&quot;</span>);
}
<span class="literal">if</span> (i != 0) {
<span class="literal">if</span> ((i + 1) % 10 == 0) {
System.<span class="ST3">out</span>.println(ANSI_WHITE);
}
}
}
}
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST4">solveAndPrint</span>(<span class="literal">boolean</span>[] array, <span class="literal">int</span> studentCount) {
<span class="literal">for</span> (<span class="literal">int</span> student = 1; student &lt;= studentCount; student++) {
<span class="literal">if</span> (<span class="ST3">debug</span>) {
System.<span class="ST3">out</span>.println(<span class="string">&quot;</span><span class="string">Student </span><span class="string">&quot;</span> + student + <span class="string">&quot;</span><span class="string"> is interacting with the lockers!</span><span class="string">&quot;</span>);
}
<span class="literal">for</span> (<span class="literal">int</span> i = 0; i &lt;= array.<span class="ST6">length</span> - 1; i++) {
<span class="literal">if</span> ((i + 1) % student == 0) {
array[i] = !array[i];
}
}
<span class="literal">if</span> (<span class="ST3">debug</span>) {
<span class="ST7">printArray</span>(array);
}
}
<span class="literal">for</span> (<span class="literal">int</span> i = 0; i &lt; array.<span class="ST6">length</span>; i++) {
<span class="literal">if</span> (array[i]) {
System.<span class="ST3">out</span>.println(<span class="string">&quot;</span><span class="string">Locker </span><span class="string">&quot;</span> + (i + 1) + <span class="string">&quot;</span><span class="string"> is open.</span><span class="string">&quot;</span>);
}
}
}
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">int</span> <span class="ST4">menu</span>() {
<span class="comment">// Create scanner</span>
Scanner input = <span class="literal">new</span> Scanner(System.<span class="ST3">in</span>);
<span class="literal">int</span> userInput;
<span class="literal">do</span> {
System.<span class="ST3">out</span>.print(<span class="string">&quot;</span><span class="string">Enter 0 to quit, and 1 to enter the number of students: </span><span class="string">&quot;</span>);
userInput = input.nextInt();
<span class="literal">if</span> (userInput == 1) {
System.<span class="ST3">out</span>.print(<span class="string">&quot;</span><span class="string">Enter the number of students: </span><span class="string">&quot;</span>);
userInput = input.nextInt();
<span class="literal">break</span>;
}
} <span class="literal">while</span> (userInput != 0);
<span class="literal">return</span> userInput;
}
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST4">main</span>(String[] args) {
<span class="literal">final</span> <span class="literal">int</span> N = <span class="ST7">menu</span>();
<span class="literal">boolean</span>[] lockers = <span class="literal">new</span> <span class="literal">boolean</span>[N];
<span class="comment">// Execute solve and print</span>
<span class="ST7">solveAndPrint</span>(lockers, N);
}
}
</pre></body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 KiB

View 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.chloefontenot</groupId>
<artifactId>MP5_ChloeFontenot</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>19</maven.compiler.source>
<maven.compiler.target>19</maven.compiler.target>
<exec.mainClass>com.chloefontenot.mp5_chloefontenot.MP5_ChloeFontenot</exec.mainClass>
</properties>
</project>

View File

@@ -0,0 +1,2 @@
#!/bin/bash
mvn exec:java -Dexec.mainClass="com.chloefontenot.mp5_chloefontenot.MP5_ChloeFontenot"

View File

@@ -0,0 +1,83 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Project/Maven2/JavaApp/src/main/java/${packagePath}/${mainClassName}.java to edit this template
*/
package com.chloefontenot.mp5_chloefontenot;
import java.util.Scanner;
/**
*
* @author chloe
*/
public class MP5_ChloeFontenot {
// Toggles execution of the printArray method.
static final boolean debug = true;
public static void printArray(boolean[] array) {
// Color codes
final String ANSI_RED = "\u001B[31m";
final String ANSI_GREEN = "\u001B[32m";
final String ANSI_WHITE = "\u001B[37m";
// Print the array
for (int i = 0; i <= array.length - 1; i++) {
if (array[i]) {
System.out.print(ANSI_GREEN + array[i] + " ");
} else {
System.out.print(ANSI_RED + array[i] + " ");
}
if (i != 0) {
if ((i + 1) % 10 == 0) {
System.out.println(ANSI_WHITE);
}
}
}
}
public static void solveAndPrint(boolean[] array, int studentCount) {
for (int student = 1; student <= studentCount; student++) {
if (debug) {
System.out.println("Student " + student + " is interacting with the lockers!");
}
for (int i = 0; i <= array.length - 1; i++) {
if ((i + 1) % student == 0) {
array[i] = !array[i];
}
}
if (debug) {
printArray(array);
}
}
for (int i = 0; i < array.length; i++) {
if (array[i]) {
System.out.println("Locker " + (i + 1) + " is open.");
}
}
}
public static int menu() {
// Create scanner
Scanner input = new Scanner(System.in);
int userInput;
do {
System.out.print("Enter 0 to quit, and 1 to enter the number of students: ");
userInput = input.nextInt();
if (userInput == 1) {
System.out.print("Enter the number of students: ");
userInput = input.nextInt();
break;
}
} while (userInput != 0);
return userInput;
}
public static void main(String[] args) {
final int N = menu();
boolean[] lockers = new boolean[N];
// Execute solve and print
solveAndPrint(lockers, N);
}
}

View File

@@ -0,0 +1,4 @@
Script started on 2023-06-27 02:14:09-05:00 [COMMAND="./run.shANSI" TERM="xterm-256color" TTY="/dev/pts/2" COLUMNS="76" LINES="38"]
zsh:1: no such file or directory: ./run.shANSI
Script done on 2023-06-27 02:14:10-05:00 [COMMAND_EXIT_CODE="127"]