Question: Complete Chapter 3, Programming Activity 2: Using Predefined Classes. Make sure you study the Programming Activity 3-2 Guidance document. Programming Activity 3-2 Guidance ================================= Equivalent

Complete Chapter 3, Programming Activity 2: Using Predefined Classes. Make sure you study the Programming Activity 3-2 Guidance document.

Programming Activity 3-2 Guidance ================================= Equivalent terms ---------------- For our purposes in this class, the following terms are synonyms: - console - Java console - command line - Command Prompt Each of these represents the standard, text-based (non-graphical), mechanism for user input and output. There is a part 1-d ------------------- The textbook does not show part 1-d, which is supposed to display the number of letters in the user's name. It is shown in the textbook's sample output. It is also included in the framework source code comments. It must be included in your solution. First name ---------- Use the Scanner object's "next" method to get the first name. Birth year ---------- Use the Scanner object's "nextInt" method to get the birth year. Age calculation --------------- To determine the user's age, subtract their birth year from the current year. Simply hard-code the current year; you are not required to find it programmatically. (If you want to find it programmatically, that is OK, but requires research.) Life percentage calculation --------------------------- To calculate the percentage of expected life already lived, divide age by average life expectancy and use "#0.0%" for the DecimalFormat pattern. Random number ------------- Use the Random class to generate a random numer. Random number guess ------------------- To get the random number guess, use the JOptionPane.showInputDialog method. To use the String guess in a calculation, first convert it to an int. Closeness of guess ------------------ To display closeness of guess, use the JOptionPane.showMessageDialog method. 

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!