Created
November 22, 2019 18:21
-
-
Save Josebuendia/4a0f2cd2852fc29124e7e8c3a5878034 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
/*@ Fintan*/ | |
public class NameApp{ | |
public static void main(String args[]){ | |
//declare variables | |
String name; | |
int length; | |
char firstLetter, lastLetter; | |
Scanner input; | |
//declare & create objects | |
Name myName = new Name(); | |
input = new Scanner (System.in); | |
//input | |
//prompt | |
System.out.println("Please enter your name"); | |
name = input.next(); | |
myName.setName(name); | |
//process | |
myName.compute(); | |
//output | |
length = myName.getLength(); | |
firstLetter = myName.getFirstLetter(); | |
lastLetter = myName.getLastLetter(); | |
System.out.println("Your name has " + length+" letters. The first letter is " +firstLetter+" and the last letter is " + lastLetter); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment