PreLab11.pdf - Computer Engineering Department TED...

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

View Full Document Right Arrow Icon
Computer Engineering Department TED University Prelab Assignment 06 (Lab 11) CMPE 112, Fall 2017 Question 1 [20 pts] Write a simple class called Maintenance.java with the following variables and constructor. Variables: year is the year of the maintenance* examiner is the person who took care of the maintenance Constructor: Write a constructor which: Gets a year and an examiner as parameter Initializes the year and the examiner E.g. public Maintenance(int y, String e) {year = y; examiner = e;} Question 2 [40 pts] Write a class called Item.java with the following variables, methods and the constructor. Variables: code is the code of the item* yearSold is the year in which the item is sold* customer is the name of the person who bought the item nrOfMt is the number of maintenance the item had mt is the array of maintenance objects initialized with 0 length, e.g. Maintenance [] mt = new…. ; Constructor: Write a constructor which: Gets the code, year sold and customer name as parameter Initializes the corresponding variables as it also initializes the nrOfMt to 0. Methods: equals gets a single Item object as parameter, e.g. public boolean equals(Item i){}. Returns true if the code of both objects are the same, returns false otherwise. addMaintenance gets year and examiner as parameter and returns nothing. This method: o creates a new Maintenance object using its constructor by giving the year and examiner as parameters. o increments the size of the mt array by one first, and add the new maintenance at the end of the array. o increments the nrOfMt by one stillGuaranteed gets a year as parameter. This method returns false if number of total maintenances
Image of page 1

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

View Full Document Right Arrow Icon
Image of page 2
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