Hi, my name is Mat and I'm new to the Java language. I recently started a programming class that focuses on Java. I'm stuck on one of the my assignments. The assignment seems fairly simple but I seem to be stuck. Here is the assignment:
-----
"Write a Java program that reads a patient’s first name, last name and age from keyboard and then creates and displays a unique patient identifier formed by the initials of each name and the reversed age value.
For example, if the patient’s first name is John, his last name is Smith and his age is 29 years old, your
program must display the following identifier:
JS92
Note: Assume the patient’s age ranges between 10 and 99."
---
Here's what I have so far:
public static void main(String[] args) {
String firstName, lastName;
int age;
System.out.println("Please enter your first name.");
Scanner keyboard = new Scanner (System.in);
firstName = keyboard.nextLine ();
System.out.println("Please enter your last name.");
lastName = keyboard.nextLine ();
System.out.println("Please enter your age.");
age = keyboard.nextInt();
String sentence = firstName + lastName + age;
int position = sentence. indexOf (firstName);
System.out.println (sentence);
{
If someone with experience could maybe offer some advice in the right direction, it would be greatly appreciated. Thank you!
-Nemus