Create new class in this package called Name

Assignment Help Basic Computer Science
Reference no: EM133860491

Question

1. Create a package called ca.bcit.comp1510.lab10

2. Create a new class in this package called Name.

3. This Name contains a String for first, middle, and last.

4. Create two constructors. One takes first, middle, last names, the second takes first, last name (middle will be set to null).

5. This Name is immutable. There are no mutators, only accessors, and the instance variables are final.

6. Validate the parameters in the constructors. Nulls are accepted for middle names, but not first names or last names. No names may be empty Strings or Strings containing nothing but whitespace. Throw an IllegalArgumentException (see slide 30 in Chapter 7) if any parameter is invalid.

7. Name implements Comparable. Add the words implements Comparable to the Name class header. The compiler will remind you that when you implement an Interface, you must implement its methods. Go ahead and do it.

8. Scroll down and you will see a new empty compareTo method. Note its parameter is another Name object. Remember the compareTo contract: Return a negative integer, zero, or a positive integer if this object is less than, equal to, or greater than the object specified as the parameter. We want to compare names or sort names COMP 1510 Bruce Link, Chris Thompson 3 of 6 alphabetically, so we can use the Strings's compareTo method. A reasonable algorithm could be something like this:

1. Compare the two last names. If they're not the same, return the value returned when you invoke the compareTo meth.

Reference no: EM133860491

Questions Cloud

What is Single Scan Multi Action : What is Single Scan Multi Action (SSMA)? A virtual device that isolates traffic so that it can be scanned for zero day threats Patented Technology
Technical requirements for Adopt-a-Farm virtual business : Identify and document high-level technical requirements for the Adopt-a-Farm virtual business. Identify one additional applicable model type for Adopt-a-Farm
Objectives of NIST Cybersecurity Framework : For customers hoping to achieve the objectives of the NIST Cybersecurity Framework, what IBM solution would you recommend for protecting the organization
Stage of designing information assurance plan : This skill is crucial through each stage of designing an information assurance plan.
Create new class in this package called Name : Create a new class in this package called Name. This Name contains a String for first, middle, and last.
Continuous cascade model emphasizes : A continuous cascade model emphasizes, Activation not being spread to the third tier of the hierarchy Sharing of information
Write basic queries against imported tables to organize : Write basic queries against imported tables to organize and analyze targeted data.
About connecting everyday : The Internet of Things (IoT) is all about connecting everyday things to the internet, making them smarter and more useful.
Context of commercial aerospace operations : Define space habitability in the context of commercial aerospace operations and describe several elements to consider when designing a space habitat

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd