Name: ________________________________________________________
Umail Address: __________________________________@ umail.ucsb.edu
Circle Lab section: 4PM 10AM 11AM noon
Please write your name only on this page. That allows me to grade your exams without knowing whose exam I am grading.
This exam is closed book, closed notes, closed mouth, cell phone off,
except for:
There are 100 points worth of questions on the exam, and you have 50 minutes to complete the exam.
A hint for allocating your time:
... indicates where other parts of the code listing have been left out for sake of space. ... is not part of the Java code....
class Track
{
private String name;
private int trackNum;
...
/** 2-argument constructor, to be used like this:
* Track t1 = new Track("Sgt. Pepper's Lonely Hearts Club Band",1);
* Track t2 = new Track("With a Little Help from My Friends",2); * * @param name name of the track * @param trackNum number of the track */
...
}
...
class Date
{
private int month;
private int day;
...
/** no-arg constructor to be used like this: * Date d = new Date(); // sets date to January 1st */
...
}
...
class Vehicle
{
private int mileage;
private String licensePlate;
...
/** getter for mileage (I'm leaving out the @param and/or @return in the
Javadoc comment so as not to give away which one you need) ... */
...
/** setter for mileage (I'm leaving out the @param and/or @return in the
Javadoc comment so as not to give away which one you need) ... */
...
}
Movie classic = new Movie ("The Godfather", "Coppola", 1974);
System.out.println("classic = " + classic);classic = Movie@34a890classic = The Godfather (Coppola, 1974)...
class Movie
{
private int title;
private int directorLName;
private int year;
...
/** 3-arg constructor * * @param theTitle the title of the movie * @param directorLName the last name of the director * @param year year the film was released */ ...
/* You DON'T need to write the constructor for this exam question; assume it has already been written. Add something else
so that you get the output indicated above. */
...
}
...
class Time
{
private int hour;
private int min;
...
...
}
! ( (x < 0) || (x >= 10) )normTemp and initializes it to the value 98.6 (choose an appropriate data type.)System.out.println(4 + 2);System.out.println("4" + 2);System.out.println (2 + 3 * 4);day refers to a string value "Friday". if (today == "Friday")
System.out.println("TGIF");
Total points: ?