Big Java Late Objects
2nd Edition
ISBN: 9781119330455
Author: Horstmann
Publisher: WILEY
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 3, Problem 18PP
When you use an automated teller machine (ATM) with your bank card, you need to use a personal identification number (PIN) to access your account. If a user fails more than three times when entering the PIN, the machine will block the card. Assume that the user’s PIN is “1234” and write a
- If the user enters the right number, print a message saying, “Your PIN is correct”, and end the program.
- If the user enters a wrong number, print a message saying, “Your PIN is incorrect” and, if you have asked for the PIN less than three times, ask for it again.
- If the user enters a wrong number three times, print a message saying “Your bank card is blocked” and end the program.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Write a program that asks the user for a number in the range of 1 through 7. The programshould display the corresponding day of the week, where 1 = Monday, 2 = Tuesday, 3 =Wednesday, 4 = Thursday, 5 = Friday, 6 = Saturday, and 7 = Sunday. The program shoulddisplay an error message if the user enters a number that is outside the range of 1 through 7
Write a program that will ask the user to enter salary amount. And then compute for the TAX amount. If salary is 10,000 and below, the tax amount is 21% of the salary amount. if the salary is between 10,001 and 30,000, the tax amount is 28% of the salary amount. If the salary is more than 30,000, the tax is 31% of the salary amount. Then compute the net salary which is the Salary amount less tax amount. Display tax amount and net Salary.
Write a program that will ask the user to enter an integer number and display the message ‘ Prime ‘ for prime number, ‘ is not Prime ‘ for not prime number
Chapter 3 Solutions
Big Java Late Objects
Ch. 3.1 - In some Asian countries, the number 14 is...Ch. 3.1 - Consider the following if statement to compute a...Ch. 3.1 - Prob. 3SCCh. 3.1 - Prob. 4SCCh. 3.1 - The variables fuel Amount and fuel Capacity hold...Ch. 3.2 - Which of the following conditions are true,...Ch. 3.2 - Prob. 7SCCh. 3.2 - What is the error in this statement? if (scoreA =...Ch. 3.2 - Supply a condition in this if statement to test...Ch. 3.2 - Prob. 10SC
Ch. 3.3 - In a game program, the scores of players A and B...Ch. 3.3 - Prob. 12SCCh. 3.3 - Prob. 13SCCh. 3.3 - Beginners sometimes write statements such as the...Ch. 3.3 - Prob. 15SCCh. 3.3 - Suppose we want to have the earthquake program...Ch. 3.4 - Prob. 17SCCh. 3.4 - Would that amount change if the first nested if...Ch. 3.4 - Prob. 19SCCh. 3.4 - Prob. 20SCCh. 3.4 - Prob. 21SCCh. 3.5 - Draw a flowchart for a program that reads a value...Ch. 3.5 - Prob. 23SCCh. 3.5 - Prob. 24SCCh. 3.5 - Draw a flowchart for a program that reads a value...Ch. 3.5 - Draw a flowchart for a program that reads a value...Ch. 3.6 - Prob. 27SCCh. 3.6 - Prob. 28SCCh. 3.6 - Prob. 29SCCh. 3.6 - Suppose you are designing a part of a program for...Ch. 3.7 - Suppose x and y are two integers. How do you test...Ch. 3.7 - How do you test whether at least one of them is...Ch. 3.7 - How do you test whether exactly one of them is...Ch. 3.7 - Prob. 34SCCh. 3.7 - What is the advantage of using the type boolean...Ch. 3.8 - In the ElevatorSimulation2 program, what is the...Ch. 3.8 - Your task is to rewrite lines 1926 of the...Ch. 3.8 - In the Sherlock Holmes story The Adventure of the...Ch. 3.8 - Prob. 39SCCh. 3 - What is the value of each variable after the if...Ch. 3 - Prob. 2RECh. 3 - Find the errors in the following if statements. a....Ch. 3 - What do these code fragments print? a. int n = 1;...Ch. 3 - Suppose x and y are variables of type double....Ch. 3 - Suppose x and y are variables of type double....Ch. 3 - Explain why it is more difficult to compare...Ch. 3 - Given two pixels on a computer screen with integer...Ch. 3 - It is easy to confuse the - and operators. Write...Ch. 3 - Each square on a chess board can be described by a...Ch. 3 - Prob. 11RECh. 3 - In a scheduling program, we want to check whether...Ch. 3 - Draw a flowchart for the algorithm in Exercise...Ch. 3 - Draw a flowchart for the algorithm in Exercise...Ch. 3 - Draw a flowchart for the algorithm in Exercise...Ch. 3 - Prob. 16RECh. 3 - Prob. 17RECh. 3 - Write pseudocode for a program that prompts the...Ch. 3 - Write pseudocode for a program that assigns letter...Ch. 3 - Explain how the lexicographic ordering of strings...Ch. 3 - Of the following pairs of strings, which comes...Ch. 3 - Explain the difference between an if/else if/else...Ch. 3 - Give an example of an if/else if/else sequence...Ch. 3 - Rewrite the condition in Section 3.3 to use ...Ch. 3 - Prob. 25RECh. 3 - Make up a Java code example that shows the...Ch. 3 - Complete the following truth table by finding the...Ch. 3 - True or false? A B is the same as B A for any...Ch. 3 - The advanced search feature of many search engines...Ch. 3 - Suppose the value of b is false and the value of x...Ch. 3 - Simplify the following expressions. Here, b is a...Ch. 3 - Simplify the following statements. Here, b is a...Ch. 3 - What is wrong with the following program?...Ch. 3 - Write a program that reads an integer and prints...Ch. 3 - Write a program that reads a floating-point number...Ch. 3 - Write a program that reads an integer and prints...Ch. 3 - Write a program that reads three numbers and...Ch. 3 - Write a program that reads three numbers and...Ch. 3 - Repeat Exercise E3.5, but before reading the...Ch. 3 - Write a program that reads in three integers and...Ch. 3 - Write a program that reads four integers and...Ch. 3 - A compass needle points a given number of degrees...Ch. 3 - Write a program that reads a temperature value and...Ch. 3 - The boiling point of water drops by about one...Ch. 3 - Add error handling to Exercise E3.11. If the user...Ch. 3 - When two points in time are compared, each given...Ch. 3 - The following algorithm yields the season (Spring,...Ch. 3 - Write a program that reads in two floating-point...Ch. 3 - Unit conversion. Write a unit conversion program...Ch. 3 - Write a program that prompts the user to provide a...Ch. 3 - Write a program that asks the user to enter a...Ch. 3 - Write a program that translates a letter grade...Ch. 3 - Write a program that translates a number between 0...Ch. 3 - Write a program that takes user input describing a...Ch. 3 - Write a program that reads in three floating-point...Ch. 3 - Write a program that reads in three strings and...Ch. 3 - Write a program that prompts for the day and month...Ch. 3 - The original U.S. income tax of 1913 was quite...Ch. 3 - Write a program that computes taxes for the...Ch. 3 - The TaxReturn.java program uses a simplified...Ch. 3 - Write a program that reads in the x- and...Ch. 3 - Write a program that reads in the x- and...Ch. 3 - Write a program that reads in the x- and...Ch. 3 - Roman numbers. Write a program that converts a...Ch. 3 - A year with 366 days is called a leap year. Leap...Ch. 3 - French country names are feminine when they end...Ch. 3 - Write a program to simulate a bank transaction....Ch. 3 - Write a program that reads in the name and salary...Ch. 3 - When you use an automated teller machine (ATM)...Ch. 3 - Calculating the tip when you go to a restaurant is...Ch. 3 - A supermarket awards coupons depending on how much...Ch. 3 - Write a program that prompts the user for a...Ch. 3 - Repeat Exercise P3.21, modifying the program so...Ch. 3 - Repeat Exercise P3.21, modifying the program so...Ch. 3 - A minivan has two sliding doors. Each door can be...Ch. 3 - Sound level L in units of decibel (dB) is...Ch. 3 - The electric circuit shown below is designed to...Ch. 3 - Crop damage due to frost is one of the many risks...Ch. 3 - A mass m = 2 kilograms is attached to the end of a...Ch. 3 - The average person can jump off the ground with a...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Using an example of a component that implements an abstract data type such as a stack or a list, show why it is...
Software Engineering (10th Edition)
Each of the program segments in this section has errors. Find as many as you can. A) int num1 = 0, num2 = 10, r...
Starting Out with C++: Early Objects
Porter’s competitive forces model: The model is used to provide a general view about the firms, the competitors...
Management Information Systems: Managing The Digital Firm (16th Edition)
Define the term unique key and give an example.
Database Concepts (8th Edition)
Describe how the average of a collection of numbers can be computed more rapidly with a multiprocessor machine ...
Computer Science: An Overview (12th Edition)
What does the following program do? 1 // Exercise 5.10: Printing.java 2 public class Printing { 3 public static...
Java How To Program (Early Objects)
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
- a. Write a program named CheckMonth that prompts a user to enter a birth month. If the value entered is greater than 12 or less than 1, display an error message; otherwise, display the valid month with a message such as 3 is a valid month. b. Write a program named CheckM0nth2 that prompts a user to enter a birth month and day. Display an error message if the month is invalid (not I through 12) or the day is invalid for the month (for example, not between 1 and 31 for January or between I and 29 for February). If the month and day are valid, display them with a message.arrow_forwardWrite a program that calculates the factorial of a number N, where N is requested from the user.The factorial of a number is: If N=0 or N=1, the factorial is 1If N is any positive number it is calculated asN! = 1 * 2 * 3 * ... * N. For example, factorial of 4 is 1 * 2 * 3 * 4 = 24 If the user enters a negative value, the following message should be displayed:"Undefined factor for negatives"arrow_forwardAirline companies apply baggage restrictions for their passengers. An airline company has decided to apply a 10kg limitation for passengers' hand luggage and 20kg for their normal baggage. When passengers arrive, they enter their hand and normal luggage weight from the keyboard. If passengers exceed their normal baggage allowance of 10 dollars per gram, they pay 12 dollars per kg. Accordingly, write the program that calculates the baggage price of the airline they will go to according to the baggage values entered by the arriving passenger and keeps this from closing the program for each passenger. Note: If hand and normal baggage allowances are stretched below the maximum value, the payment amount will be considered not negative. An example printout is given on the right. Geri bildirim gönderarrow_forward
- PYTHON PROGRAMMINGarrow_forwardWrite a program that asks the user to enter 2 integers of 4 digits and displays thedifferent digits as X and * if they are the same. If the user enters a number which is notof four digits, then a convenient message is displayed.arrow_forwardUsing Python Write a program that displays all numbers from 1 to y that are divisible by x, where x and y are entered by the user:Example:if x = 3 and y = 30, the output is 3, 6, 9, 12, 15, 18, 21, 24, 27, 30arrow_forward
- Write a program that gets the number and a letter. If the letter is ‘f’, the program should treat the number entered as temperature in degrees Celsius and convert it into the temperature in degree Fahrenheit and print a suitable message. If the letter is ‘c’, the program should consider the number as Fahrenheit temperature and convert it to Celsius temperature and print a suitable message. The program should display error message and then exit if the user enters any other letter. Use c++ language to implement this program. …………………………………………………………………………………………………Formulas: Celsius to Fahrenheit: 9.0/5.0 * value + 32 Fahrenheit to Celsius: 5.0/9.0 * (value-32) Note: Do this using Switch statement.arrow_forwardPython Programming onlyarrow_forwardWrite a program that reads from the user a number that represents its grade, and then displays a message to tell the user if he passed the exam (if the entered grade is greater than or equal to 60) or not (if the entered grade is less than 60). The entered grade should be a number between 0 and 100. Otherwise, the program displays an error message. Sample Run: Please enter your grade (between 0 and 100): 75 Congratulations! You have passed the exam. Please enter your grade (between 0 and 100) : 45.5 Unfortunately... You have not passed the exam. Please enter your grade (between 0 and 100) : 112 ERROR: You have entered a wrong grade!arrow_forward
- A parking garage charges a $2.00 minimum fee to park for up to three hours and an additional $1 per hour for each hour or part thereof over four hours. The maximum charge for any given 24-hour period is $10.00. Assume that no car parks for longer than 24 hours at a time. Write a program that will calculate and print the parking charges for each of three customers who parked their cars in this garage yesterday. You should enter the hours parked for each customer. Your program should print the results in a neat tabular format, and should calculate and print the total of yesterday's receipts. The program should use the function calculate Charges to determine the charge for each customer.arrow_forwardi need the answer quicklyarrow_forwardWrite a program that asks for the number of calories and fat grams in a food. The program should display the percentage of calories that come from fat. If the calories from fat are less than 30% of the total calories of the food, it should also display a message indicating that the food is low in fat. One gram of fat has 9 calories, so Calories from fat = fat grams * 9. The percentage of calories from fat can be calculated as Calories from fat ÷ total calories . Input Validation: Make sure the number of calories and fat grams are not less than 0. Also, the number of calories from fat cannot be greater than the total number of calories. If that happens, display an error message indicating that either the calories or fat grams were incorrectly entered.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Constants, Variables, Data types, Keywords in C Programming Language Tutorial; Author: LearningLad;https://www.youtube.com/watch?v=d7tdL-ZEWdE;License: Standard YouTube License, CC-BY