Reset author name to chosen name

This commit is contained in:
2025-10-19 22:00:41 -05:00
parent 12cf757236
commit 168b35c94a
287 changed files with 0 additions and 17381 deletions

View File

@@ -1,16 +0,0 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
*/
package edu.slcc.asdv.chloe.lab5.recursion2_chloefontenot;
/**
*
* @author chloe
*/
public class Lab5Recursion2_ChloeFontenot {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}

View File

@@ -1,32 +0,0 @@
/*
* 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 edu.slcc.asdv.chloe.lab5.recursion2_chloefontenot;
/**
*
* @author chloe
*/
public class NestedLoopsIndexes {
static final int ROWS = 3;
static final int COLUMNS = 5;
public static void nestedLoopsIndexesR(int i, int j) {
if (j == COLUMNS) {
System.out.println();
return;
} else if (i == ROWS) {
return;
}
System.out.print(i + ", " + j + " ");
nestedLoopsIndexesR(i, ++j);
if (i + 1 == j) {
nestedLoopsIndexesR(++i, 0);
}
}
public static void main(String[] args)
{
nestedLoopsIndexesR(0, 0);
}
}

View File

@@ -1,33 +0,0 @@
/*
* 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 edu.slcc.asdv.chloe.lab5.recursion2_chloefontenot;
import java.util.Scanner;
/**
*
* @author chloe
*/
public class OccurancesOfChar {
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
System.out.print("Enter a string: ");
String s = input.nextLine();
System.out.print("Enter a character: ");
char ch =input.nextLine().charAt(0);
int times = count(s, ch);
System.out.println(ch + " appears " + times
+ (times > 1 ? " times " : " time ") + "in " + s);
}
public static int count(String str, char a) {
int result = 0;
if (str.length() > 0) {
result = count(str.substring(1), a) +
(( str.charAt(0) == a) ? 1 : 0);
}
return result;
}
}

View File

@@ -1,36 +0,0 @@
/*
* 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 edu.slcc.asdv.chloe.lab5.recursion2_chloefontenot;
import java.util.Scanner;
/**
*
* @author chloe
*/
public class OccurencesOfSpecifiedCharacterInArray {
public static void main(String[] args)
{
System.out.print("Enter a string: ");
Scanner input = new Scanner(System.in);
String s = input.nextLine();
char[] items = s.toCharArray();
System.out.print("Enter a character: ");
char ch = input.nextLine().trim().charAt(0);
System.out.println(ch + " appears " + count(items, ch) + " times.");
}
public static int count(char[] chars, char ch) {
return count(chars, chars.length - 1, ch);
}
public static int count(char[] chars, int high, char ch) {
if (high >= 0) {
return count(chars, high - 1, ch) + (ch == chars[high] ? 1 : 0);
} else {
return 0;
}
}
}

View File

@@ -1,30 +0,0 @@
/*
* 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 edu.slcc.asdv.chloe.lab5.recursion2_chloefontenot;
import java.util.Scanner;
/**
*
* @author chloe
*/
public class ReverseInt {
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
System.out.print("Enter an integer: ");
int i = input.nextInt();
System.out.print("The reversal of " + i + " is ");
reverseDisplay(i);
System.out.println();
}
public static void reverseDisplay(int value) {
if (value != 0) {
System.out.print(value % 10);
value = value / 10;
reverseDisplay(value);
}
}
}

View File

@@ -1,52 +0,0 @@
/*
* 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 edu.slcc.asdv.chloe.lab5.recursion2_chloefontenot;
/**
*
* @author chloe
*/
public class SelectionSortR {
public static void selectionSortR(int[] arr)
{
selectionSortR(arr, 0, arr.length);
}
public static void swap(int[] arr, int i, int j)
{
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
public static void selectionSortR(int[] arr, int i, int n)
{
// Selection sort
int min = i;
for (int j = i + 1; j < n; ++j) {
if (arr[j] < arr[min]) {
min = j;
}
}
swap(arr, min, i);
if ( i + 1 < n) {
selectionSortR(arr, i +1, n);
}
}
public static void main(String[] args)
{
int[] arr = {
8, 2, 1, 1, 7, 4, -1, 50, 49
};
selectionSortR(arr);
for (int i = 0; i < arr.length; ++i) {
System.out.print(arr[i] + " ");
}
System.out.println();
}
}

View File

@@ -1,37 +0,0 @@
/*
* 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 edu.slcc.asdv.chloe.lab5.recursion2_chloefontenot;
import java.util.Scanner;
/**
*
* @author chloe
*/
public class SumOfDigits {
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
System.out.print("Enter an integer: ");
int i = input.nextInt();
System.out.print("The sum of digits in " + i
+ " is " + sumDigits(i));
System.out.println();
}
public static long sumDigits(long n)
{
// Base case: if the number is a single digit, return it
if (n < 10) {
return n;
} else {
// Recursive case: sum the last digit and call the function on the remaining digits
long lastDigit = n % 10;
long remainingDigits = n / 10;
return lastDigit + sumDigits(remainingDigits);
}
}
}

View File

@@ -1,26 +0,0 @@
/*
* 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 edu.slcc.asdv.chloe.lab5.recursion2_chloefontenot;
/**
*
* @author chloe
*/
public class SumSeries1 {
public static void main(String[] args)
{
System.out.printf("%-10s%15s\n", "1", "m(i)");
for (int i = 1; i <= 10; ++i) {
System.out.printf("%-10d%-15.6f\n",i, m(i));
}
}
public static double m(int i) {
if (i == 1) {
return 1;
} else {
return m(i - 1) + 1.0 / i;
}
}
}

View File

@@ -1,26 +0,0 @@
/*
* 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 edu.slcc.asdv.chloe.lab5.recursion2_chloefontenot;
/**
*
* @author chloe
*/
public class SumSeries2 {
public static void main(String[] args)
{
System.out.printf("%-10s%15s\n", "i", "m(i)");
for (int i = 1; i <= 10; ++i) {
System.out.printf("%-10d%-15.6f\n",i, m(i));
}
}
public static double m(int i) {
if (i == 1) {
return 1.0 / 3;
} else {
return m(i - 1) + (double) i / (2 * i + 1);
}
}
}

View File

@@ -1,34 +0,0 @@
/*
* 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 edu.slcc.asdv.chloe.lab5.recursion2_chloefontenot;
import java.util.Scanner;
/**
*
* @author chloe
*/
public class UpperCaseInArray {
public static void main(String[] args)
{
System.out.print("Enter a string: ");
Scanner input = new Scanner(System.in);
String s = input.nextLine();
char[] items = s.toCharArray();
System.out.println("The number of uppercase letters is "
+ count(items));
}
public static int count(char[] chars) {
return count(chars, chars.length - 1);
}
public static int count(char[] chars, int high) {
if (high >= 0) {
return count(chars, high - 1) + (Character.isUpperCase(chars[high]) ? 1 : 0);
} else {
return 0;
}
}
}