{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

PreLab07 - Name Section Leader Edward Leon Knapp Pre-Lab 07...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Name: Edward Leon Section Leader: Knapp Pre-Lab 07 – CSC 127A – Spring 2008 (10 points) Required Reading: Sections 6.1- 6.3, 6.4.1-6.4.4, 6.5, 6.6 (pp 310-314), 6.7, 6.8, 6.10.1, 6.10.2 (pp. 328- 332), 6.11 1. Explain what an event is and what a sentinel value is with specific regards to event-controlled looping. Event is used when the user uses the while technique because it repeats a set of instructions for each input even though it does not know how many inputs there will be. Sentinel is used when the user specifies the end of their inputs. 2. Describe in detail the hasNext( ) method of the Scanner class. The hasNext method of Scanner returns true or false when used. It returns true if it has another token. It returns false if it has reached the end of the file. 3. Describe a possible scenario in which a program would result in a InputMismatchException and how you would fix it. Be Specific. InputMismatchException appears when the next token entered does not match the data type specified earlier in the program. Some ways to fix it is to re-enter the correct data type or change the
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern