{"id":427,"date":"2012-09-16T20:05:50","date_gmt":"2012-09-17T03:05:50","guid":{"rendered":"http:\/\/blogs.unsw.edu.au\/infs1609\/?p=427"},"modified":"2012-09-16T21:30:58","modified_gmt":"2012-09-17T04:30:58","slug":"lab-week-9-classes","status":"publish","type":"post","link":"https:\/\/blogs.unsw.edu.au\/infs1609\/blog\/2012\/09\/lab-week-9-classes\/","title":{"rendered":"Lab Week 9 &#8211; Classes"},"content":{"rendered":"<h3>Classes<\/h3>\n<p>Consider a database of student records for the university. What kind of data would be associated with each student?<\/p>\n<ul>\n<li>Download the <a href=\"http:\/\/www.cse.unsw.edu.au\/~cs1400\/labs\/Lab9.zip\">Lab9 BlueJ project<\/a>. It defines a new class\u00a0<code>Student<\/code> which contains some student information<\/li>\n<li>Create students a number of students in BlueJ. Use the Inspector to examine their fields.<\/li>\n<li>Use the\u00a0<code>getName()<\/code> method to access the student\u2019s name.<\/li>\n<li>Write your own accessor methods to get the address and year enrolled.<\/li>\n<li>Add a field to record the student\u2019s gender. Update the constructor to initialise this value appropriately using a parameter. Add an accessor method.<\/li>\n<li>Add a field to record the student\u2019s age. Update the constructor to initialise the age to the default value of 18.<\/li>\n<li>Add a second constructor that allows you to specify an age other than the default.<\/li>\n<li>Add a\u00a0<code>static final<\/code> constant to the class for the default age, to avoid using 18 as a magic number in your code.<\/li>\n<\/ul>\n<p>Consider designing a class representing a car in a database for a used car lot.<\/p>\n<ul>\n<li>What kinds of data would be recorded about each car?<\/li>\n<li>What are the types of this data?<\/li>\n<li>Write a Car class representing an entry in this database. Give it:\n<ol>\n<li>Fields recording the above data.<\/li>\n<li>A public constructor.<\/li>\n<li>Public accessor methods to read the data.<\/li>\n<\/ol>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Classes Consider a database of student records for the university. What kind of data would be associated with each student? Download the Lab9 BlueJ project. It defines a new class\u00a0Student which contains some student information Create students a number of students in BlueJ. Use the Inspector to examine their fields. Use the\u00a0getName() method to access [&hellip;]<\/p>\n","protected":false},"author":345,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[236],"tags":[],"class_list":["post-427","post","type-post","status-publish","format-standard","hentry","category-tutorials"],"_links":{"self":[{"href":"https:\/\/blogs.unsw.edu.au\/infs1609\/wp-json\/wp\/v2\/posts\/427","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.unsw.edu.au\/infs1609\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.unsw.edu.au\/infs1609\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.unsw.edu.au\/infs1609\/wp-json\/wp\/v2\/users\/345"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.unsw.edu.au\/infs1609\/wp-json\/wp\/v2\/comments?post=427"}],"version-history":[{"count":5,"href":"https:\/\/blogs.unsw.edu.au\/infs1609\/wp-json\/wp\/v2\/posts\/427\/revisions"}],"predecessor-version":[{"id":431,"href":"https:\/\/blogs.unsw.edu.au\/infs1609\/wp-json\/wp\/v2\/posts\/427\/revisions\/431"}],"wp:attachment":[{"href":"https:\/\/blogs.unsw.edu.au\/infs1609\/wp-json\/wp\/v2\/media?parent=427"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.unsw.edu.au\/infs1609\/wp-json\/wp\/v2\/categories?post=427"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.unsw.edu.au\/infs1609\/wp-json\/wp\/v2\/tags?post=427"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}