tutorial_7_assignment_solved_docx.pdf - KINGSAUDUNIVERSITY...

This preview shows page 1 - 2 out of 2 pages.

KINGSAUDUNIVERSITY COLLEGE OF COMPUTER AND INFORMATION SCIENCES INFORMATION TECHNOLOGY DEPARTMENT CSC111: Computer Programming I Tutorial #7 1 st Semester 1436-1437 PART II: (Assignment) Q1: write a program to manage a phone book that can hold up to 100 slots ,the program should display a menu with the following options: 1- Add new number, the program should add the number in the first available slot. 2- Look for 3 numbers in the phone book that end with 2 or 5. The program should print the index of each found number. Display an appropriate message if the search is not fulfilled. 3- The menu repeats as long as the user needs. Public static void main(String args []){ Scanner sc = new Scanner(System. in ); // Telephone book example int [] telbook = newint [100]; int num ; char choic ; do { //start do..while // display menu System. out .println( " Select an option from the menu" ); System. out .println( " 1 ) Add new number to the phone book" ); System. out .println( " 2 ) find 3 numbers ending with 2 OR 5" ); //read option from user int c = sc .nextInt(); //test option switch ( c ) {
Image of page 1

Subscribe to view the full document.

Image of page 2
  • Fall '10
  • ZuhairShentuf
  • Computer Programming, Computer program, Grammatical number, Computer and Information Sciences

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

Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes