Java Programming Basic Requirements ~Use Scanner class to accept input from user
ID: 3646365 • Letter: J
Question
Java Programming Basic Requirements ~Use Scanner class to accept input from user (this is done) ~prompt user for first name, last name, and age. (each individually... this is also done) ~compare length of first and last name if they are the same print: (can not get strings to compare and compile correctly) hello "" Your first and last name both have 'n' letters ~If first and last names are different size print: Hello "" The length of your first name is: (n) The length of your last name is: (m) ~create a loop to print a table with all the characters in the user's full name and their corresponding ASCII value. You may use the charAt() method of the string class to identify each of the characters in the full name and type cast them as int to obtain their ASCII value. ~ print users age ~ print out the year user was born (subtract age from current year) ~using increment, increase age by one ~using compound assignment operators, increase age by 4 ~ask user "Should we do this again? (y/n)" For some reason I am having trouble putting it all together. I'm not sure if it is because it was not explained well enough, or if I just do not understand out to put it all together. I'm fairly new at JAVA, and I can get it all separately but when I try to put it all into one program I can not get it to work. Any help would be appreciated. J.Explanation / Answer
import java.util.Scanner; class Scanner Prgm { public static void main(String[] args) { Scanner input=new Scanner(System.in); String firstname; System.out.print("Enter first name "); first name=input.next(); String familyname; System.out.print("Enter family name "); family name=input.next(); String fullname; fullname =firstname+" "+familyname; System.out.print("Fullname is ",+fullname); } }
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.