1.What Expo class method would you use to enter someone’s name? System.out.print("Enter name ===>> ");
2.Why is a prompt necessary for program input? Without a prompt, the user would just see the cursor flashing on the screen and have no idea what to enter. Chances are the user would not even know he/she is supposed to enter something. With the prompt, the user knows not only that he/she is supposed to enter something; he/she will also know what they are supposed to enter.
3.What does the enterString method do? The enterString method "reads" in an entire string of characters from the keyboard until the key is pressed.
4.Look at program Java0503.java. This program gives the impression that it will find the sum of 2 entered numbers. Why does it not work? Program Java0502.java, in figure 5.2, demonstrates how to write a program with multiple lines of input entered from the keyboard during program execution.
5.If someone says, “The 2 strings were concatenated” what does that mean? It simply joins the 2 strings together. In program Java0503.java, the 2 numbers were entered as strings
6.Look at program Java0504.java. How does this program cure the problem of the previous one? . Program Java0504.java, in figure 5.4, makes a small, but very significant change by using enterInt.
7.What Expo class method is used to enter real number information? The mean of three real numbers entered at the keyboard. Now we are using the enterDouble command.
8.What Expo class method is used to enter a single letter or character?
the enterChar command command is designed for any time you want to enter just a single character.
9.Refer to your answer to the previous question. Give an example of where this command would be useful. example would be if you created a computerized multiple choice test. The user needs to enter A, B, C, D or E.
10.What Expo method should you use to enter someone’s name? Expo.enterString() is used to enter a String from the text screen.
11.What Expo method should you use to enter someone’s age? Expo.enterInt() is used to enter an int from the text screen.
12.What Expo method should you use to enter someone’s gpa? Expo.enterDouble() is used to enter a double from the text screen.
13.What Expo method should you use to enter someone’s middle initial? Expo.enterChar() is used to enter a char from the text screen.
14.What does program flow follow? Program Flow follows the exact sequence of listed program statements, unless directed otherwise by a Java control structure.
15.In what computer language do programs require control structures? Programs in any computer language require control structures
16.What are the 3 general types of control structures? They are simple sequence, selection, and repetition.
17.How does Simple Sequence work? Simple sequence holds no surprises. A series of program statements are executed in the exact sequence that they are written.
18.What are 2 synonyms for Selection? Selection is also called conditional branching or decision making.
19.What are the 3 types of Selection? There are 3 types of selection: one-way, two-way and multiple-way.
20.Selection control structures use a special _ conditional _ statement.
21.In one-way selection, when does the program flow branch off? . In the case of one-way selection, the true condition branches off.
22.In one-way selection, what happens if the condition is false? If the condition is false, the program flow continues without change in program sequence.
23.When using two-way selection can both directions or both ways be selected? No, The two-way selection structure selects one direction, or the other direction, but never both
24.Give a real-life example of Two-Way Selection. (Not the one that is in the book.) driving from Austin back to Dallas. The highway you would take is I35 (Interstate 35). When you are about 70 miles from Dallas, shortly after you pass the town of Hillsboro the highway forks. It splits in two. You need to decide between going left which means you will take I35W (Interstate 35 West) to Fort Worth or going right which means you will take I35E (Interstate 35 East) to Dallas.
25.Explain Repetition. Another common application occurs when repetition is required. A grade book program needs to average grades for every student in a class of twenty-five students. A payroll program needs to process paychecks for many employees. Practically everything you can imagine is done multiple times. Nobody is interested in repeating program source code 500 times for some task that is to be performed 500 times. We want to create one program segment, and place this segment in some type of loop control structure that repeats 500 times.
26.What do Selection and Repetition control structures have in common? Both the selection control structure diagrams and the repetition diagram indicate a change of program flow occurring after some condition
27.What is the essence of understanding, and using, control structures? . Understanding conditional statements is the essence of understanding, and using, control structures. However, before we plunge into the syntax of the various conditional statements, you need to understand the relational operators that are used by Java in the conditional statements.
28.What is a conditional statement?
A conditional statement is a program expression, which evaluates to true or false.
29.Most conditional statements will require what? Most conditional statements require a relational operator.
30.All conditions must be placed inside what?
All conditions must be placed inside parentheses.
31.What kind of operator is required to make an expression evaluate to true or false? A relational operator is required to make an expression evaluate to true or false
32.List the 6 relational operators. . Java has six relational operators: Equals, Not equals, Greater than, Less than, Greater than or equal to, and Less than or equal to.
33.Java does not use “=” to test for equality. What does it use instead? Because that is an equality operator ( =) not the assignment operator (==).
34.What kind of operator is “=”? assignment operator