mercredi 16 octobre 2019

How to create an if else condition for 2 substrings? (Java)

I’m a new program and I have an assignment due in which I basically have to program using Java to retrieve an input from the console and encrypt it according to the periodic table’s atomic symbols. Here are the exact steps I am to follow:

  1. Go through the original string from left to right
  2. Look at the first 2 characters
  3. Verify if those 2 characters match 1 of the elements in the periodic table a. If it does, use the atomic number as a replacement for those 2 characters b. If it doesn’t, go back and look at just 1 character i. Verify if that character matches 1 of the elements in the periodic table a. If it does, use the atomic number as a replacement for that character b. If it doesn’t, leave that character unchanged
  4. Repeat the process until you reach the end of the original string
  5. Display the encrypted String

Can someone please guide me or tell me how to do this because I’m very confused. Thank you!!!!

Deema

Aucun commentaire:

Enregistrer un commentaire