Advertisement
Guest User

Untitled

a guest
Sep 1st, 2014
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. package CallExt;
  2. //Author Lervik
  3. //Date 01.09.2014
  4.  
  5. import java.util.Scanner;
  6.  
  7. public class MinOppgave01 {
  8. public static void main (String args[]) {
  9. /*
  10. This file have the task of handling user input and an array. (The user can search the array for a title.)
  11. */
  12.  
  13. String[] titles = {
  14. "Fellowship","Two Towers","Return Of The King"
  15. };
  16.  
  17. Scanner in = new Scanner(System.in);
  18. String searchtitle = "";
  19.  
  20. for (String title:titles){
  21.  
  22.  
  23. System.out.println("Type the title of a book to see if its in storage");
  24. searchtitle = in.nextLine();
  25.  
  26. if (title.equals(searchtitle)){
  27. System.out.println("The title " + (searchtitle) + " is aviable in storage.");
  28. searchtitle = "";
  29. }
  30.  
  31. else {
  32. System.out.println("The title is not aviable in storage.");
  33. searchtitle = "";
  34. }
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement