3.2. Tabbed PanelΒΆ

A tabbed panel can have several tabs. It is often used to show a problem and an answer.

The following is from the Java Review ebook. See it at the following link JavaTimed.

The following code should calculate the cost of a trip that is 300 miles if gas is $2.50 a gallon and your car gets 36 miles per gallon. However, the code has syntax errors, like missing semicolons, wrong case on names, or unmatched " or (. Fix the code so that it compiles and runs correctly.

Line 5 is missing a semicolon. Line 6 has Double instead of double. Remember that the primitive types all start with a lowercase letter. Line 8 has tripmiles instead of tripMiles. Remember that you should uppercase the first letter of each new word to make the variable name easier to read (use camel case).

The following example is from the How to Think Like a Computer Scientist ebook. See the following link Tabbed.

  1. Write a function to count how many odd numbers are in a list.

Next Section - 3.3. Reveal: Hide or Show Content