All pastes #390476 Raw Edit

Unnamed

public java v1 · immutable
·published 2007-03-11 14:10 UTC
rendered paste body
package mainSys;public class Decryptor {		private int gRight; 	private double tPercent;		public void Decrypt(String guessStr, String realStr)	{				//Cycle through the answer and check each character against the guess of the player		//And tally correct character matches		gRight = 0; 		tPercent = 0.0;				for(int i = 0; i < realStr.length(); i++)		{			char a = realStr.charAt(i);			char b = guessStr.charAt(i);			if(a == b)			{				gRight++;			}			System.out.println(gRight);		}				//Figure out what percentage of the total characters they got		tPercent = gRight / realStr.length() * 100 ;		System.out.println(tPercent);			}		public double getPercent()	{		return tPercent;	}}////////////// PASSED FROM///////           if(inText.length() == gText.length())		{			decrypt.Decrypt(gText, inText);									if(decrypt.getPercent() == 100.00)			{				JOptionPane.showMessageDialog(null,"Congratulations! You've Solved The Cipher!");			}			else 			{			JOptionPane.showMessageDialog(null,"You've Got: " + decrypt.getPercent() +"% Of The Code Correct.");			}								}