Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
7th Edition
ISBN: 9780134802213
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 9, Problem 5PC
Program Plan Intro
Password Verifier
Program Plan:
The detail of “PasswordDemo” class is shown below:
- In the “main()” method,
- Declare the required variable.
- Read the password input from user.
- Check whether the password is valid or not. If yes,
- Display the error message to user.
- Otherwise, display the valid password message to user.
- Exit the system.
The detail of “PasswordVerifier” class is shown below:
- Declare and initialize the minimum password length.
- In the isValid() method,
- Declare the variable.
- Check whether the password is valid or not. If yes,
- Set the status as “true”.
- Otherwise, set the status as “false”.
- Return the status.
- In the hasUpperCase() method,
- Declare the variable.
- The for loop executes until length of string. If yes,
- Check the string has at least one uppercase character. If yes, set the status as “true”.
- Return the status.
- In the hasLowerCase() method,
- Declare the variable.
- The for loop executes until length of string. If yes,
- Check the string has at least one lowercase character. If yes, set the status as “true”.
- Return the status.
- In the hasDigit() method,
- Declare the variable.
- The for loop executes until length of string. If yes,
- Check the string contains numeric digit. If yes, set the status as “true”.
- Return the status.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
C# PROGRAMMING
OOP1 - Objects, Classes, and Encapsulation
Create a program that has the following method and corresponding usage.
1. AreaCircle - compute the area of the circle
Java prgm based
E-commerce ApplicationTakealot is an e-commerce company with a website that offers products to buy. During stock taking, the company records the following properties for each product:• Product ID in the format 10#, where # represents any numeric value• Product Name e.g. iPhone 12• Product Type e.g. mobile phone• Product Manufacturer e.g. Apple• Product Price e.g. R24000You have been hired as the Java developer for Takealot and have been provided with a text file called Products containing five products sold on the Takealot website. Below is sample data from the text file:101, Apple iphone 12, Mobile phone, Apple, 24000.00102, Dell laptop, Electronics, Dell, 18999,99103, Samsung 9kg Washing Machine, Electronic, Samsung, 7000.99104, Wireless Keyboard, Electronic, Microsoft, 101.99105, LG 65-inch TV, Electronic, LG, 14999,99
Develop a Java program for Takealot in any IDE of your choice using the information provided in the scenario above. The program must consist of a class called Product…
Chapter 9 Solutions
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Ch. 9.2 - Prob. 9.1CPCh. 9.2 - Write an if statement that displays the word digit...Ch. 9.2 - Prob. 9.3CPCh. 9.2 - Write a loop that asks the user, Do you want to...Ch. 9.2 - Prob. 9.5CPCh. 9.2 - Write a loop that counts the number of uppercase...Ch. 9.3 - Prob. 9.7CPCh. 9.3 - Modify the method you wrote for Checkpoint 9.7 so...Ch. 9.3 - Look at the following declaration: String cafeName...Ch. 9.3 - Prob. 9.10CP
Ch. 9.3 - Prob. 9.11CPCh. 9.3 - Prob. 9.12CPCh. 9.3 - Prob. 9.13CPCh. 9.3 - Look at the following code: String str1 = To be,...Ch. 9.3 - Prob. 9.15CPCh. 9.3 - Assume that a program has the following...Ch. 9.4 - Prob. 9.17CPCh. 9.4 - Prob. 9.18CPCh. 9.4 - Prob. 9.19CPCh. 9.4 - Prob. 9.20CPCh. 9.4 - Prob. 9.21CPCh. 9.4 - Prob. 9.22CPCh. 9.4 - Prob. 9.23CPCh. 9.4 - Prob. 9.24CPCh. 9.5 - Prob. 9.25CPCh. 9.5 - Prob. 9.26CPCh. 9.5 - Look at the following string:...Ch. 9.5 - Prob. 9.28CPCh. 9.6 - Write a statement that converts the following...Ch. 9.6 - Prob. 9.30CPCh. 9.6 - Prob. 9.31CPCh. 9 - The isDigit, isLetter, and isLetterOrDigit methods...Ch. 9 - Prob. 2MCCh. 9 - The startsWith, endsWith, and regionMatches...Ch. 9 - The indexOf and lastIndexOf methods are members of...Ch. 9 - Prob. 5MCCh. 9 - Prob. 6MCCh. 9 - Prob. 7MCCh. 9 - Prob. 8MCCh. 9 - Prob. 9MCCh. 9 - Prob. 10MCCh. 9 - To delete a specific character in a StringBuilder...Ch. 9 - Prob. 12MCCh. 9 - This String method breaks a string into tokens. a....Ch. 9 - These static final variables are members of the...Ch. 9 - Prob. 15TFCh. 9 - Prob. 16TFCh. 9 - True or False: If toLowerCase methods argument is...Ch. 9 - True or False: The startsWith and endsWith methods...Ch. 9 - True or False: There are two versions of the...Ch. 9 - Prob. 20TFCh. 9 - Prob. 21TFCh. 9 - Prob. 22TFCh. 9 - Prob. 23TFCh. 9 - int number = 99; String str; // Convert number to...Ch. 9 - Prob. 2FTECh. 9 - Prob. 3FTECh. 9 - Prob. 4FTECh. 9 - The following if statement determines whether...Ch. 9 - Write a loop that counts the number of space...Ch. 9 - Prob. 3AWCh. 9 - Prob. 4AWCh. 9 - Prob. 5AWCh. 9 - Modify the method you wrote for Algorithm...Ch. 9 - Prob. 7AWCh. 9 - Look at the following string:...Ch. 9 - Assume that d is a double variable. Write an if...Ch. 9 - Write code that displays the contents of the int...Ch. 9 - Prob. 1SACh. 9 - Prob. 2SACh. 9 - Prob. 3SACh. 9 - How can you determine the minimum and maximum...Ch. 9 - Prob. 1PCCh. 9 - Prob. 2PCCh. 9 - Prob. 3PCCh. 9 - Prob. 4PCCh. 9 - Prob. 5PCCh. 9 - Prob. 6PCCh. 9 - Check Writer Write a program that displays a...Ch. 9 - Prob. 8PCCh. 9 - Prob. 9PCCh. 9 - Word Counter Write a program that asks the user...Ch. 9 - Sales Analysis The file SalesData.txt, in this...Ch. 9 - Prob. 12PCCh. 9 - Alphabetic Telephone Number Translator Many...Ch. 9 - Word Separator Write a program that accepts as...Ch. 9 - Pig Latin Write a program that reads a sentence as...Ch. 9 - Prob. 16PCCh. 9 - Lottery Statistics To play the PowerBall lottery,...Ch. 9 - Gas Prices In the student sample program files for...
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Object-Oriented Programming ❤❤❤ Matchmaker with Java ❤❤❤ Summary: Create a Java application that will determine your true love. Prerequisites: Java, VS Code, and Terminal In this assignment you will develop and test a command-line application written in the Java language that asks questions to determine if a person is your true love. More specifically your application should ask five questions in the form of statements and allow the user to respond to each statement with the numbers 1 through 5 with 1 indicating strongly disagree and 5 indicating strongly agree. You will then compare the person’s answers with your desired “true love” answers. The closer the answers are to your desired “true love” answers the better match the two of you are for each other. For example, suppose you choose the statement “Broccoli is delicious.” and your desired answer was 1 (strongly disagree) because you really don’t like broccoli. If the application user entered 4 (agree), then the two of you would not…arrow_forwardPYTHON ONLY PLZZZ Create a class object with the following attributes and actions: Class Name Class number Classroom Semester Level Subject Actions: Store a class list Print the class list as follows: Class name Class Number Semester Level Subject Test your object: Ask the user for all the information and to enter at least 3 classes test using all the actions of the object print using the to string action Describe the numbers and text you print. Do not just print numbers or strings to the screen explain what each number represents.arrow_forwardpython Cylinder class: Instance variables: Make instance variables appropriately to accomplish the tasks you need. Methods: ?_init_ :: constructor, initializes instance variables o Additional Parameters: diameter and height (in that order) o Assumption: diameter and height will always be numbers which represent measurements in millimeters o Temporary Assumption (we will fix this later): diameter will never be negative and height wilI always be positive number above o ? get_volume : returns the volume of the cylinder based on its height o Additional Parameters: No additional parameters (just self). .0 Note: Use pi from the math module ?_str__ :: returns string representation with this format: "Cylinder (radius: 20.25mm, thickness: 6.10mm, volume: 7858.32mm^3)" o Additional Parameters: No additional parameters. o Notes: ? The quotes in the example are just our string boundaries! The first character in the above example is C. ? This method reports the radius (NOT the diameter). ? All…arrow_forward
- Name: Instructor Course: ITSE 2321 Object-Oriented Programming (Java) Program: Four This program computes an employee's gross, net, and overtime pay. Enter your ID Number: 1001 Enter your pay rate: 12.50 Enter your hours worked: 36 Program 4 ID Number: Pay Rate: Regular Hours: Overtime Hours: Total Hours: Regular Pay: Overtime Pay: Gross Pay: Tax: Deductions: Net Pay: 1001 12.50 36.00 0.00 36.00 450.00 0.00 450.00 0.00 35.00 415.00arrow_forwardC# Console Application for Minesweeper In this milestone, students will create three classes: Cell, Board, and Program. Create a class that models a game cell. A game cell should have the following properties: a.Its row and column. These should initially be set to -1. b.Its visited boolean value. This should initially be set to false. c.Live boolean value. This should initially be set to false. "Live" set to true will indicate that the cell is a "live bomb" cell. d.The number of neighbors that are "live." This should initially be set to 0. The Cell class should have a constructor, as well as getters and setters for all properties. 3.Create a class that models a game board. A game board should have the following properties: a.Size. The board will be square, where the size includes the dimensions of both the length and width of the board. b.Grid. The grid will be a 2-dimensional array of the type cell. c.Difficulty. A percentage of cells that will be set to "live" status. 4.The Board…arrow_forwardJava Progarrow_forward
- C# languagearrow_forwardNumber of electoral votes: 200Number of popular votes: 300arrow_forwardPython GUI tkinter: Write a program where the GUI display is My favorite soda is Coca-Cola. Whe the user clicks on soda, they have these following options in a menu: beverage drink refresher When the user clicks on Coca-Cola, the following are listed as menu options: Pepsi Mountain Dew Once a selection is made, the entire sentence changes. For example, the user selects beverage and Pepsi: My favorite beverage is Pepsi.arrow_forward
- CMPG 122 User Interface Programming Prak 10 Chapter 6: Modularizing Your Code with Methods 1. Charges in a Luxury Resort (Nr 6, Page 410) Create an application that calculates the total cost of a hotel stay. The daily accommodation charge is $550. The hotel also provides other services like restaurant and bar, spa, car rental, and medication and rehabilitation. The application should accept the following input: E The number of days spent in the hotel E The restaurant charges including VAT É The amount accrued from spa and health treatments E The amount accrued in car rental E The amount accrued in medical and rehabilitation services Create and use the following value-returning methods in the application: A CalcStayCharges () - Calculates and returns the base charges for the hotel stay. This is computed as $450 times the number of days in the hotel. e CalcMiscCharges () - Calculates and returns the total of the food bill, spa charges, car rental, and medication and rehabilitation…arrow_forwardComputer Science Help with C# programming in Microsoft Visual Studio: You will be creating a program that uses a GUI to allow the user to enter information about an employee. In addition to the main class you create, there will also be four additional classes named fileOutput, baseEmployee, superEmployee and advancedEmployee which you will have to create. For this problem, the baseEmployee class will need to accept user input for a name, email and address for a base employee. The advancedEmployee class should be able to extend the baseEmployee, by allowing an hourly rate and hours worked to be entered. Hours worked must be in the range of 0 to 80 and hourly rate is in the range of 10 to 42.50. The superEmployee class will then extend the advancedEmployee class and allow permission level of high, medium or low to be entered, along with their office number. The program should show a radio button that allows the user to choose whether or not the user is a base employee, advanced…arrow_forwardFlight schedule Java program for Netbeans IDE 19. Bonus: In the absence of a direct flight, find a pair of connecting flights between two airports with an intermediate stop at another airport. Calculate layover time (the wait time between connecting flights.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT