Giter Club home page Giter Club logo

year-11-cs-unit-6-quiz-student's Introduction

Year-11-CS-Unit-6-Quiz-Student

Ensure that you read all instructions carefully. Do not include any additional variables or methods that are not specified in this quiz description. Each question is worth one mark and is binary. That is, you either get 1 mark or 0 marks for each question (there are 13 questions on this quiz hence this quiz is worth 13 marks in total). The only application that is to be running on your computer is your IDE (until you are ready to submit your quiz). When you are ready to submit your quiz, please share it on github and ensure that all of your work has been pushed to your repository. Double check this by confirming that your completed classes exist in your repository on github. Submit the link to your repository on Schoology.

Good luck, have fun! :)

class Address

  1. An Address class will have three instance variables. Ensure that each instance variable is declared as private.
  • district (String)
  • street (String)
  • streetNumber (int)
  1. An Address class will have one constructor.
  • The constructor will have three parameters. The three parameters will be used to initialize the three instance variables.
  1. An Address class will have a getter method for each instance variable.
  2. An Address class will have a setter method for each instance variable.
  3. An Address class will have a toString method that returns, for example, a String in the following format:
  • "180 Tung Lo Wan Road, Causeway Bay"

class Student

  1. A Student class will have five instance variables. Ensure that each instance variable is declared as private.
  • age (int)
  • firstName (String)
  • lastName (String)
  • year (int)
  • address (Address)
  1. A Student class will have one constructor.
  • The constructor will have five parameters. The five parameters will be used to initialize the five instance variables.
  1. A Student class will have a getter method for each instance variable.
  2. A Student class will have a setter method for each instance variable.
  3. A Student class will have a private method called addOneAge that is parameterless and increments the age of the Student.
  4. A Student class will have a method called birthday that calls addOneAge and returns the age of the Student.
  5. A Student class will have a toString method that returns, for example, a String in the following format:
  • "Belinda Yu, age 17, year 12, 180 Tung Lo Wan Road, Causeway Bay"

class StudentMaker

Inside the main method …

  1. Create an Address object. The reference to this Address object should be called address. The district should be Causeway Bay, street Tung Lo Wan Road, and street number 180.
  2. Create a Student object. The reference to this Student object should be called student. The Student’s name should be Belinda Yu, age 17, year 12, address 180 Tung Lo Wan Road, Causeway Bay. This should be done in a single statement.
  3. Use a setter method to change the Student's first name from Belinda to Bella.
  4. Use a getter method and print statement to print out the age of Bella. Print out the age only, and use the println method to print. Do this using a single statement.
  5. Call the birthday method and store this into a variable called age.
  6. Print out the contents of the variable called age. Use the println method to print.
  7. Print out the current state of the Student object. That is, print the reference to the Student object. This will automatically call the toString method.

year-11-cs-unit-6-quiz-student's People

Contributors

techarenz avatar t-w2007 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.