FirstName_LastName_SerialNumber Clas: The First_Last_SerialNumber class is used by the Home Software Company to validate software serial numbers. A valid software serial number is in the form LLLLL-DDDD-LLLL, where L indicates an alphabetic letter and D indicates a numeric digit. For example, WRXTQ-7786-PGVZ is a valid serial number. Notice that a serial number consists of three groups of characters, delimited by hyphens.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

In JAVA 

HERE IS SerialNumberTester class:

public class SerialNumberTester
{
public static void main(String[] args)
{
String serial1 = "GHTRJ-8975-AQWR"; // Valid
String serial2 = "GHT7J-8975-AQWR"; // Invalid
String serial3 = "GHTRJ-8J75-AQWR"; // Invalid
String serial4 = "GHTRJ-8975-AQ2R"; // Invalid
// Validate serial1.
First_Last_SerialNumber sn = new First_Last_SerialNumber(serial1);
if (sn.isValid())
System.out.println(serial1 + " is valid.");
else
System.out.println(serial1 + " is invalid.");
// Validate serial2.
sn = new First_Last_SerialNumber(serial2);
if (sn.isValid())
System.out.println(serial2 + " is valid.");
else
System.out.println(serial2 + " is invalid.");
// Validate serial3.
sn = new First_Last_SerialNumber(serial3);
if (sn.isValid())
System.out.println(serial3 + " is valid.");
else
System.out.println(serial3 + " is invalid.");
// Validate serial4.
sn = new First_Last_SerialNumber(serial4);
if (sn.isValid())
System.out.println(serial4 + " is valid.");
else
System.out.println(serial4 + " is invalid.");
}
}

You will need to turn in a java classes file: FirstName_LastName_SerialNumber .java
GOOD LUCK!
FirstName_LastName_SerialNumber Class
The First_Last_SerialNumber class is used by the Home Software Company to validate software serial numbers. A
valid software serial number is in the form LLLLL-DDDD-LLLL, where L'indicates an alphabetic letter and D
indicates a numeric digit. For example, WRXTQ-7786-PGVZ is a valid serial number. Notice that a serial number
consists of three groups of characters, delimited by hyphens.
UML diagram for the First_ Last_SerialNumber class.
SerialNumber
|- first : String
|- second : String
|- third : String
- valid : booloan
+ SerialNumber(sn : String)
+ isValid() : boolean
|- validate() : void
|- isFirstGroupValid: boolean
|- isSecondGroupValid : boolean
|- isThirdGroupValid : boolean
The fields first, second, and third are used to hold the first, second, and third groups of characters in a serial number.
The valid fi eld is set to true by the constructor to indicate a valid serial number, or false to indicate an invalid serial
number.
FirstName_LastName_SerialNumber elass's meckods
Method
Description
Constructor
The constructor accepts a string argument that contains a serial number. The string is
tokenized and its tokens are stored in the first, second, and third fields. The validate
method is called.
isValid
This method returms the value in the valid field.
This method calls the isFirstGroupValid, isSecondGroupValid , and isThirdGroupValid =
methods to validate the first, second, and third fields.
This method retums true if the value stored in the first field is valid. Otherwise, it returns
false.
validate
isFirstGroupValid
isSecondGroupValid This method returns true if the value stored in the second field is valid. Otherwise, it
returns false.
This method retums true if the value stored in the third field is valid. Otherwise, it returms
false.
is ThirdGroupValid
You can use the SerialNumberTester class provided to test your First_Last_SerialNumber class
Transcribed Image Text:You will need to turn in a java classes file: FirstName_LastName_SerialNumber .java GOOD LUCK! FirstName_LastName_SerialNumber Class The First_Last_SerialNumber class is used by the Home Software Company to validate software serial numbers. A valid software serial number is in the form LLLLL-DDDD-LLLL, where L'indicates an alphabetic letter and D indicates a numeric digit. For example, WRXTQ-7786-PGVZ is a valid serial number. Notice that a serial number consists of three groups of characters, delimited by hyphens. UML diagram for the First_ Last_SerialNumber class. SerialNumber |- first : String |- second : String |- third : String - valid : booloan + SerialNumber(sn : String) + isValid() : boolean |- validate() : void |- isFirstGroupValid: boolean |- isSecondGroupValid : boolean |- isThirdGroupValid : boolean The fields first, second, and third are used to hold the first, second, and third groups of characters in a serial number. The valid fi eld is set to true by the constructor to indicate a valid serial number, or false to indicate an invalid serial number. FirstName_LastName_SerialNumber elass's meckods Method Description Constructor The constructor accepts a string argument that contains a serial number. The string is tokenized and its tokens are stored in the first, second, and third fields. The validate method is called. isValid This method returms the value in the valid field. This method calls the isFirstGroupValid, isSecondGroupValid , and isThirdGroupValid = methods to validate the first, second, and third fields. This method retums true if the value stored in the first field is valid. Otherwise, it returns false. validate isFirstGroupValid isSecondGroupValid This method returns true if the value stored in the second field is valid. Otherwise, it returns false. This method retums true if the value stored in the third field is valid. Otherwise, it returms false. is ThirdGroupValid You can use the SerialNumberTester class provided to test your First_Last_SerialNumber class
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY