a4 - ASSIGNMENT 4 Records and Objects COMP-202B Winter 2010...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
ASSIGNMENT 4 Records and Objects COMP-202B, Winter 2010, All Sections Due: Wednesday, March 31, 2010 (23:55) You MUST do this assignment individually and, unless otherwise specified, you MUST follow all the general instructions and regulations for assignments. Graders have the discretion to deduct up to 10% of the value of this assignment for deviations from the general instructions and regulations. Part 1, Question 1: 0 points Part 1, Question 2: 0 points Part 2, Question 1: 65 points Part 2, Question 2: 35 points 100 points total Part 1 (0 points): Warm-up Do NOT submit this part, as it will not be graded. However, doing these exercises might help you to do the second part of the assignment, which will be graded. If you have difficulties with the questions of Part 1, then we suggest that you consult the TAs during their office hours; they can help you and work with you through the warm-up questions. Warm-up Question 1 (0 points) Create a file called MyPoint.java which contains a class called MyPoint . This class should define two attributes of type double called x and y . Inside this class, declare a public and static method called main() ; this method should create create an instance of class MyPoint whose address in memory is stored in variable p . Assign values to the x and y fields of the object whose address is stored in reference variable p , then display the values of these fields using System.out.println() . Warm-up Question 2 (0 points) Create a file called MyTest.java which contains a class called MyTest . Inside this class, declare a public and static method called main() ; this method should create an instance of class String whose address in memory is stored in variable s . This instance of class String should represent the character String "COMP 202" . Call the contains() method multiple times, using the reference variable s as a target, but passing a different actual parameter value ( "OMP" , "C" , "T" , "20" , and so on) each time; observe the values returned by the calls to the contains() method by displaying them using System.out.println() . Part 2 (65 + 35 = 100 points) The questions in this part of the assignment will be graded. Question 1: Garage Car Management Application (65 points) In this question, you will be creating a small garage management application. This application will be 1
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
create and maintain an array of Car records; the concept underlying this application is similar to that of a database system, but with far fewer details. Each Car record will have six fields. The first five fields represent a car’s make (of type String ), its model (of type String ), its year (of type int ), its serialNumber (of type long ), and the number of repairs made on the car ( numberRepairs , of type int ) that the system has tracked. The last field, named repairs , is an array of Repair objects which will keep track of the last ten Repair s performed on the Car .
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern