Please take time to read the code disclaimer.

<--Go back to Kent's Projects

<--Go back to project post

//*************************************************************************
//	FightSong.java		Author: Kent Dodds
//	Part 4 of Lab 1
//*************************************************************************


public class FightSong{
	//---------------------------------------------------------------------
	/**	# display the entire BYU Fight Song
		# display the locations of the first lowercase 'b', 'y', and 'u'
			in the BYU fight song (3 separate locations)
		# display the length of the BYU fight song (in number of characters)
		# display the entire BYU Fight Song with all uppercase letters
		# assume that Orson Pratt was the second president of the Church
			(change all 'b's to 'o's and 'y's to 'p's, both upper and lower case characters)
		# display the OPU fight song
		# display the first location of "OPU" in the OPU fight song (all three together).
	*/	
	//---------------------------------------------------------------------
	public static void main (String[] args){
		String song = "Rise, all loyal Cougars and hurl your challenge to the foe.\nWe will fight, day or night, rain or snow.\nLoyal, strong, and true\nWear the white and blue.\nWhile we sing, get set to spring.\nCome on, Cougars, it's up to you. Oh!\nRise and shout, the Cougars are out\nalong the trail to fame and glory.\nRise and shout, our cheers will ring out\nAs you unfold your vict'ry story.\nOn you go to vanquish the foe\nfor Alma Mater's sons and daughters.\nAs we join in song in praise of you our faith is strong.\nWe'll raise our colors high in the blue\nAnd cheer our Cougars of BYU.";
		System.out.println(song +"\n");//displays song, and makes white space
		System.out.println("The first b is at "+song.indexOf('b'));
		System.out.println("The first y is at "+song.indexOf('y'));
		System.out.println("The first u is at "+song.indexOf('u')+"\n");//last three lines find the location of the first instances of 'b', 'y', and 'u' and prints white space
		System.out.println("This song is "+song.length()+" characters long.\n");//print song length
		System.out.println("Here you go, ALL CAPS!!!\n");
		System.out.println(song.toUpperCase()+"\n");//Upper case the song
		System.out.println("One thing you may not know is that Orson Pratt\nwas actually the real second President of the Church.\n");
		
		song = song.replace('B', 'O');
		song = song.replace('Y', 'P');
		song = song.replace('b', 'o');
		song = song.replace('y', 'p');
		System.out.println(song+"\n");
		System.out.println("The OPU is at "+song.indexOf("OPU"));
		}//end main
} //end program