I've recently taken up an AP Computer Science class online for Maryland State education at my high school, and was wondering if I could receive help on a few of the projects. Most of them are simple like programs I made in Visual Basic for my first programming class with simple algorithms. There are a lot of projects given at a fast pace, and we do not have any instructor, but rather just some notes given to us online. Most of the time I have to look things up on the web to figure out how to complete the program.
At the moment I'm working on a Car Rental program that takes the input of the make and model, which are irrelevent to the algorithm, and the license plate number of a rental car. It then uses a formula to calculate the rental code as follows:
Example license plate input: CPR 607
1. Take each char from the input seperately and determine its ASCII value. (C = 67, P = 80, R = 82)
2. Add the ASCII values together and % by 26. (67 + 80 + 82 = 229 ... 229 % 26 = 4)
3. Find the letter position of that number in the alphabet (i.e. A = 0, B = 1 , etc...).
4. Take the sum of the ASCII values and add it to the integer in the input (229 + 607 = 836).
5. Take the letter you found and add the sum of the integers together (E836)
The primary problem I have with this program is step 4, as I do not know how to read the integer after a white space. I know the use of readToken() is usually for this, but it isn't for integers, and readInt() wasn't found. If anyone could help me with this it would be greatly appreciated.