Question: /* Chapter 3 Programming Activity 2 Calling class methods Anderson, Franceschi */ // ***** add your import statements here public class PracticeMethods { public static

/* Chapter 3 Programming Activity 2 Calling class methods Anderson, Franceschi */ // ***** add your import statements here public class PracticeMethods { public static void main(String [] args) { //***** // 1. a. Create a Scanner object to read from the console // b. Prompt the user for their first name // c. Print a message that says hello to the user // d. Print a message that says how many letters // are in the user's name // Part 1 student code starts here: // Part 1 student code ends here. //***** // 2. a. Skip a line, then prompt the user for the year // they were born. // b. Calculate and print the age the user will be this year. // c. Declare a constant for average life expectancy, // set its value to 77.9 // d. Print a message that tells the user the percentage // of their expected life they've lived. // Use the DecimalFormat class to format the percentage // Part 2 student code starts here: // Part 2 student code ends here. //***** // 3. a. Generate a random integer between 1 and 20 // b. Pop up an input dialog box and ask the user for a guess. // c. Pop up an output dialog box telling the user the number // and how far from the number the guess was (hint: use Math.abs) // Part 3 student code starts here: // Part 3 student code ends here. } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!