Concept explainers
Having a secure password is a very important practice, when much of our information is stored online. Write a
- The password must be at least 8 characters long.
- The password must have at least one uppercase and one lowercase letter
- The password must have at least one digit.
Write a program that asks for a password, then asks again to confirm it. If the passwords don’t match or the rules are not fulfilled, prompt again. Your program should include a method that checks whether a password is valid.
Want to see the full answer?
Check out a sample textbook solutionChapter 5 Solutions
Big Java Late Objects
Additional Engineering Textbook Solutions
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Introduction to Programming Using Visual Basic (10th Edition)
Starting Out with Python (4th Edition)
Problem Solving with C++ (10th Edition)
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Starting Out with C++ from Control Structures to Objects (9th Edition)
- The cost of renting a room at a hotel is, say $100.00 per night. For special occasions, such as a wedding or conference, the hotel offers a special discount as follows: If the number of rooms booked at least 10, the discount is 10%; at least 20, the discount is 20%; and at least 30, the discount is 30%. Also if rooms are booked for at least three days, then there is an additional 5% discount. Write a program that prompts the user to enter the cost of renting one room, the number of rooms booked, the number of days the rooms are booked, and the sales tax (as a percent). The program outputs the cost of renting one room, the discount on each room as a percent, the number of rooms booked, the number of days the rooms are booked, the total cost of the rooms, the sales tax, and the total billing amount. Your program must use appropriate named constants to store special values such as various discounts.arrow_forwardpython: invite the user to enter a username. If they enter "Secret Agent", invite them to enter a password. If the password is 007, print a welcome message using their username and their real name (James Bond). If the user enters a username that is not Secret Agent or enters a password that is not 007, print an appropriate message to inform them.arrow_forwardWrite a program that asks the user to enter a password consisting of 7 characters. If the user enters a password which is not exactly 7 characters, the program should ask the user to enter a password again until the user complies. If the user enters a password which is less than 7 characters, the program should produce a message saying “The password is too short. Only passwords with 7 characters are accepted. Try again.” If the user enters a password which is more than 7 characters, the program should produce a message saying “The password is too long. Only passwords with 7 characters are accepted. Try again.” answer quicklyarrow_forward
- The Café Noir Coffee Shop wants some market research on its customers. When a customer places an order, a clerk asks for the customer’s zip code and age. The clerk enters that data as well as the number of items the customer orders. The program operates continuously until the clerk enters a 0 for zip code at the end of the day. When the clerk enters an invalid zip code (more than 5 digits) or an invalid age (defined as less than 10 or more than 110), the program reprompts the clerk continuously. When the clerk enters fewer than 1 or more than 12 items, the program reprompts the clerk two more times. If the clerk enters a high value on the third attempt, the program accepts the high value, but if the clerk enters a negative value onthe third attempt, an error message is displayed and the order is not counted. At the end of the program, display a count of the number of items ordered by customers from the same zip code as the coffee shop (54984), and a count from other zip codes. Also…arrow_forwardImagine you are developing a software package that requires users to enter their own passwords. Your software requires that user’s passwords meet the following criteria: • The password should be at least six characters long. • The password should contain at least one uppercase and at least one lowercase letter. • The password should have at least one digit.Write a program that asks for a password and then verifies that it meets the stated criteria. If it doesn’t, the program should display a message telling the user why.arrow_forwardThe language needed is just beginner Python. I am having trouble with creating this program. You are creating a new account and need to provide a password. The password has the following requirements: The password must be at least 6 characters and at most 20 characters. It must contain at least one lowercase letter, one uppercase letter, and one number. Write a program that prompts the user to input a password and checks if the password is valid. If the password is valid, print a confirmation statement. If it is not, print a statement that the password is not valid. Include appropriate comments to make your code more readable.arrow_forward
- Write a program that allows a user to enter any number of student quiz scores, as integers, until the user enters 99. If the score entered is less than 0 or more than 10, display Score must be between 10 and 0 and do not use the score. After all the scores have been entered, display the number of valid scores entered, the highest score, the lowest score, and the arithmetic averagearrow_forwardYou are asked to write a java program to prepare for the Lebanese parliament elections. Your program asks the voter to enter his name, age, record number and gender. Based on the below table, your program should inform the voter about his voting location. Remember that in Lebanon the legal voting age should be greater than 20. Gender Voting Location Record Number Between 1 and 100 Male Female Male Between 1 and 100 Between 101 and 200 Between 101 and 200 Between 201 and 300 Zahret El Ihsan | Room number 1 Zahret El Ihsan | Room number 2 Ali Ben Abi Taleb Room number 7 Ali Ben Abi Taleb | Room number 8 Al Akhtal El Saghir | Room number 1 Female Both Using java Your program should execute exactly as the below sample run. Sample Run 1: Enter Your name, Gender (M or F), Age and Record Number Elie M 21 105 Dear Elie You vote : Ali Ben Abi Taleb | Room number 7 Sample Run 2: Enter Your name, Gender (M or F), Age and Record Number Ali M 20 200 Sorry Ali, You are not allowed to vote! Sample…arrow_forwardWrite a program that prompts the user to enter two words. The program prints "true" if the two words end with the same character and only one (not both) of the words has an odd number of characters, and prints 'false' otherwise. For example: Input blue azure Erica Pinker Result Enter the first word: Enter the second word: true Enter the first word: Enter the second word: false Hello Enter the first word: benvenuto Enter the second word: falsearrow_forward
- Write a program in which the user to type his own ID, if the ID is valid it will ask him to enter his password, if the password is correct the program will print the name of the user, otherwise the program will print Incorrect Password and if the ID does not exist , the program will print Incorrect ID.arrow_forwardA hotel has a certain number of rooms. Each room can be either single bed or double bed type and may be AC or non-AC type. The rooms have different rates depending on whether they are of single or double, AC or Non-AC types. The room tariff however may vary during different parts of the year depending up on the occupancy rate. For this, the computer should be able to display the average occupancy rate for a given month, so that the manager can revise the room tariff for the next month either upwards or downwards by a certain percentage. Perform structured analysis and structured design for this Hotel Automation Software—software that would automate the book keeping activities of a 5-star hotel.Guests can reserve rooms in advance or can reserve rooms on the spot depending upon availability of rooms. The receptionist would enter data pertaining to guests such as their arrival time, advance paid, approximate duration of stay, and the type of the room required. Depending on this data and…arrow_forwardwrite a program in python Write a program that will allow a student to enter their name and then ask them to solve 10 mathematical equations. The program should display two random numbers that are to be added, such as: 247 + 129 The program should allow the student to enter the answer. The program should then display whether their answer was right or wrong, and accumulate the right values. After the 10 questions are asked, calculate the average that was correct. Then display the student name, the number correct, and the average correct in both decimal and percentage format. In addition to any system functions you may use, you might consider the following functions: A function that allows the student to enter their name. A function that gets two random numbers, anywhere from 1 to 500. A function that displays the equation and asks the user to enter their answer. A function that checks to see if the answer is correct and accumulates the number correct. A function that calculates the…arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning