First off this is a homework assignment and I'm looking for some help because I'm stuck. I've been working on this for hours and couldn't figure it out. I'm trying to take a user input as a string and store it as a char array and output the characters in all Uppercase without using the toUpperCase()
method.
I've written the code so far and my plan is to create two arrays which contains the lowercase alphabet and the uppercase alphabet and create and for loop and inside that an if statement which replaces the characters int the char array and outputs them in Uppercase. But I can't figure out how to replace the characters. This is what I got so far:
import java.util.Scanner;
class Q4{
public static void main(String []args){
Scanner input = new Scanner(System.in);
System.out.print("Enter a String: ");
String s = input.nextLine();
String s1 = s.toLowerCase();
char[] s2 = s1.toCharArray(); //Converts the String into a char Array
char LowerAlp[] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char UpperAlp[] = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
for(int i=0; i<s2.length; i++){
if(s2==LowerAlp){
//Here is the problem
}
}
}
}