Write Java code . Write a class called Q5 that has the following: A static method that
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a class called Q5 that has the following: A static method that checks whether a given String is a valid Irish PPS number: 7 digits followed by either 1 letter or by 2 letters (either upper or lower case); the method should return true if it is valid, false otherwise. The main method that tests the above method in 2 different threads; the threads must be created using anonymous classes where you override the run() as follows: first get the thread to pause for 2 seconds, then print its name; then call the above method in each thread with one of the following strings ("1234567FA" (valid), "123567GN" (not valid), "1200567m" (valid), "1277767zw" (valid), "1234567_A" (not valid)) and output whether the string passed is a valid Irish PPS number. Then in the main thread print the following details of the main thread: name and priority. You must ensure that the 2 threads finish their execution before the main thread is executed. Write a class called Q5 that has the following: A static method that checks whether a given String is a valid Irish PPS number: 7 digits followed by either 1 letter or by 2 letters (either upper or lower case); the method should return true if it is valid, false otherwise. The main method that tests the above method in 2 different threads; the threads must be created using anonymous classes where you override the run() as follows: first get the thread to pause for 2 seconds, then print its name; then call the above method in each thread with one of the following strings ("1234567FA" (valid), "123567GN" (not valid), "1200567m" (valid), "1277767zw" (valid), "1234567_A" (not valid)) and output whether the string passed is a valid Irish PPS number. Then in the main thread print the following details of the main thread: name and priority. You must ensure that the 2 threads finish their execution before the main thread is executed.
Expert Answer:
Answer rating: 100% (QA)
public class Q5 public static boolean isValidPPSString pps if ppslength 9 String digits ppssubstring... View the full answer
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date:
Students also viewed these programming questions
-
All elements of the structure in Figure P3?47 have the same AE except element 1, which has an axial stiffness of 2AE. Find the displacements of the nodes and the stresses in elements 2, 3, and 4 by...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Solution Description: For this assignment, create files with the following names: Superhero.java ChargedSuperhero.java FlyingSuperhero.java Creating a Superhero 1.Create a class called Superhero that...
-
Suppose you observe the following exchange rates: 1 = $1.50; 120 = $1.00. Calculate the euro-yuan exchange rate. Group of answer choices a. 80 = 1.00 b. 1 = 2.50 c. 133.33 = 1.00 d. 1.00 = 180
-
Determine the internal normal force, shear force, and moment at pointC. 0.2 m, 400 N IC -1.5 m- 2 m
-
Solve the following equations for x to five-figure accuracy 2x a. 1 +0.13 +41 +0.13 X 365 $831 ) 1 0.13 x20.13 x 59 $831 b. 3x(1.035) +++-$2500 1.033
-
What is a diatom, and why are diatoms important to many other marine organisms?
-
1. Is seasonal exponential smoothing the best model for forecasting Urban Run athletic wear? Why? 2. Explain what has happened to the data for Urban Run. What are the consequences of continuing to...
-
1 0 . What type of passing parameter based on the following code fragment? class Student { public static void main ( String [ ] args ) { Student s = new Student ( Ali , 2 1 ) ; printData ( s ) ; }...
-
What are the major causes of information risk? How can information risk be reduced?
-
Currently you are purchasing from SEPC under FOB Shanghai Incoterms 2010. a) Is this the most appropriate term? Explain. b) Assume you do not want to pay freight costs but do want insurance coverage....
-
ESSAY PRACTICE FOR EXAM PAYOFF MATRIX QUESTIONS B\A A A MANGOES PEACHES B MANGOES 5/14 10/10 B PEACHES 12/12 14/5 (a) Explain what As best response is if B Plants MANGOES AND what would be A's best...
-
Suppose f is the function defined by: f(x)=x^(2)+7x+12 (a) Find the vertex of f(x) (b) Find the x-intercept s (also known as the zeros ) of f(x) if they exist
-
The strength of the local and national economies is often measured by the unemployment rate. The total workforce includes the number of people who are employed and the number of people actively...
-
Save your program as Project1.java (...this implies the name of your Class. Don't forget!), ZIP it into a zip file names Project1.zip, and submit Project1.zip to Canvas in the Project 1 link by the...
-
Ten annual returns are listed in the following table: -19.4% 16.1% 18.1% -49.6% 43.9% 1.4% - 16.6% 46.4% 44.7% -3.6% a. What is the arithmetic average return over the 10-year period? b. What is the...
-
Headquartered in Bella Vista, Australia, Woolworths Limited is the largest retail company in Australia and New Zealand and the largest food retailer in both countries. The largest division is...
-
CLASS PERIO Solving Linear Equations: Variable on Both Sides Solve each equation. 1) 6r+ 7 = 13 + 7r 3) -7x-3x+2=-8x-8 5)-14 +66+7-26=1+5b 7) n-3n = 14-4n 2) 13-4x=1-x 4)-8-x= x - 4x 6)n+2=-14-n 8)...
-
Suppose that we are selling boxes of candy for a fund-raiser. We have five kinds of candy to sell: Mints, Chocolates with Nuts, Chewy Chocolates, Dark Chocolate Creams, and Sugar-Free Suckers. We...
-
Consider a class ScienceFairProjectRating that will be used to help judge a science fair project. It will use the class RatingScore described in the previous exercise. The attributes for the new...
-
Implement your base class for the hierarchy from the previous exercise. Previous exercise. Consider a program that will keep track of the items in a schools library. Draw a class hierarchy, including...
-
To what extent is the English common law significant in contemporary American criminal law?
-
What is the essential difference between substantive criminal law and procedural criminal law? Can you give examples of each?
-
Should morality, in and of itself, be considered a sufficient basis for defining particular conduct as criminal?
Study smarter with the SolutionInn App