Java 3 Final


 


Please respond to the following.


  • 1) An outer wrapper contains { }
  • 2) { } are also known as curly braces and/or curly brackets.
  • 3) The first letter of a class must always start with an upper case
    letter.

  • 4) The first letter of a class must always start with a lower case
    letter.

  • 5) //The following is a better ticket machine.
    The above sentence is an example of a single line comment.

  • 6) //**The following is a better ticket machine,
    The above sentence is an exmaple of a single line comment.

  • 7) "Playa" is a java key word.
  • 8) Java code usually contains fields, constructors, and methods.
  • 9) Java code usually contains assignment statements and conditional
    statements.

  • 10) Assignment statements have an equal sign = in them.
  • 11) The following is a java key word:



  • 12) The following is the proper way to start a java class:



  • 13) The following is an assignment statement



  • 14) The following is the most closely related to a conditional
    statement:




  • 15) The following are fields:



  • 16) The following is the proper way to write a constructor:



  • 17) Which of the following will return the price of a ticket?


  • 18) Which of the following will return the balance?


  • 19) Which of the following will let you insert money?


  • 20) Which of the following will allow you to print a ticket?


  • 21) Which of the following are acceptable ways of starting a class?



  • 22) Which of the following is the proper way to write out the class
    called student.




  • 23) The fields store data for:



  • 24) The constructors allow:



  • 25) The methods implement the behavior of:



  • 26) This is an extra credit question! (Worth 4 points)
    Which of the following is the proper order inside the outer wrapper
    curly brackets that is preferred by the author of your text book.






  • 27) Name 10 Java Keywords (reserved words for the Java technology
    language). (1 point each)

  • 28) Extra Credit!
    Name 10 more Java Keywords (reserved words for the Java technology
    language.) (1/2 point each,rounded up)

  • 29) Write a correct java code for the following: (65 points total)

    1. An outer wrapper with a class named TicketMachine. (15 points)

    2. Fields containing price, balance,and total. (15 points)

    3. A constructor that is public TicketMachine (int ticketCost). (15
    points)

    4. It must contain the three assignment statements of:
    price = ticketCost; balance = 0; and total = 0. (10 points)

    5. The code must be able to getPrice and return the price,
    getBalance and return the balance, and simulate the
    printing of a ticket. (10 points)