CSE1020 Week 3 Tutorial

Task 1A: I Spy in the TYPE API

Press Ctrl+T to open a new tab in your web browser. Go to the course website and click on the "Links" link (on the left side). Open the API of the TYPE library. Scan through the pages to answer the following questions:

  1. How many constructors does the CreditCard class have? What is the difference between them?

  2. What class can help you solve and algebraic equation of the second degree? What method would you call to get the root(s) of the equation?

  3. What is the return type of the add method in the Fraction class? Where is the sum stored?


Task 1B: I Spy in the Java API

Go back to the course website and click on the link to the Java API. Scan through the pages to answer the following questions:

  1. What constant represents the closese approximation of PI?

  2. What method calculates the square root of a number?

  3. What is the maximum value an int can have? (Hint: Check the Integer class.)

  4. How many println methods are there in the PrintStream class?

  5. What method returns the length of a String?