Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
11th Edition
ISBN: 9780134670942
Author: Y. Daniel Liang
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 10, Problem 10.7PE
Program Plan Intro
Simulation of an Automatic Teller Machine (ATM)
Program Plan:
- Define the required public class definition.
- Define required constructor.
- Print the data field using System.out.println().
- Declare if statement.
- Print the data field using System.out.println().
- Define for loop.
- Print the data field using System.out.println().
- Define while loop.
- Declare the int variable.
- Declare switch statement and required cases.
- Declare the scanner using java.util.scanner.
- Define the main function in the class using public static void main(String[] args).
- Declare required constructor.
- Print the data field using System.out.println().
- Declare required constructor.
- Print the data field using System.out.println().
- Declare if statement.
- Print the data field using System.out.println().
- Declare required constructor.
- Define the int variables.
- Define while loop.
- Print the data field using System.out.println().
- Declare if statement.
- Print the data field using System.out.println().
- Return the required value.
- Close the main function.
- Close the public class definition.
- Define the required class definition.
- Declare the required private data types.
- Declare the constructor.
- Declare the getter method.
- Return the required data field.
- Declare the setter method.
- Declare the getter method.
- Return the required data field.
- Declare withdraw and deposit methods.
- Close the class definition.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
(TicTacToe Class) Create a class TicTacToe that will enable you to write a complete programto play the game of tic-tac-toe. The class contains as private data a 3-by-3 two-dimensional arrayof integers. The constructor should initialize the empty board to all zeros. Allow two human players.Wherever the first player moves, place a 1 in the specified square. Place a 2 wherever the second player moves. Each move must be to an empty square. After each move, determine whether the gamehas been won or is a draw. If you feel ambitious, modify your program so that the computer makesthe moves for one of the players. Also, allow the player to specify whether he or she wants to go firstor second. If you feel exceptionally ambitious, develop a program that will play three-dimensionaltic-tac-toe on a 4-by-4-by-4 board. [Caution: This is an extremely challenging project that couldtake many weeks of effort!]
Rewrite the client program to use the Baby class that you have done using ArrayList.
You should also have the following function in this new client program:
a) Enter details for each baby (name and age) and thus populate the Baby ArrayList
b) Calculate and display the average age of all babies in the ArrayList
c) Ask the user to enter the name of a baby, and then remove it from the ArrayList
d) Allow the user to add new baby information in the ArrayList
e) Output the details of each baby from the ArrayList (name and age) Compare this client program using the ArrayList with the client program you have done using array, comment on the differences between the two.
Modify your client program in the last question, by adding a sort function such that when that option is selected, it sorts the ArrayList using the baby names in alphabetical order and output the details in the sorted ArrayList to a CSV (sortedbabylist.csv) file.
public class Baby {
private String name;
private int age;…
(FYI: Pseudocode is required (Not any programming language)
Design a pseudocode program that loads an array with the following 7 values. Add one more word (of your own choosing) for a total of 8 words.
biffcomelyfezmottleperukebedraggledquisling
Be sure to use lowercase, as shown above. This will make the processing easier.
Ask the user to enter a word
Search through this array until you find a match with the word the user entered.
Once you find a match, output "Yes, that word is in the dictionary".
If you get to the end of the array and do NOT find a match, output "No, that word is not in the dictionary".
The program should work with any set of words in the arrays. If I were to change the words in the arrays, it should still work.
If you need help, look at the search example in your textbook.
Chapter 10 Solutions
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Ch. 10.2 - Prob. 10.2.1CPCh. 10.3 - Is the BMI class defined in Listing 10.4...Ch. 10.4 - Prob. 10.4.1CPCh. 10.4 - Prob. 10.4.2CPCh. 10.4 - Prob. 10.4.3CPCh. 10.4 - Prob. 10.4.4CPCh. 10.7 - Prob. 10.7.1CPCh. 10.7 - Prob. 10.7.2CPCh. 10.7 - How do you convert an integer into a string? How...Ch. 10.7 - Show the output of the following code: public...
Ch. 10.7 - Prob. 10.7.5CPCh. 10.8 - What are autoboxing and autounboxing? Are the...Ch. 10.8 - Show the output of the following code. public...Ch. 10.9 - What is the output of the following code? public...Ch. 10.10 - Suppose s1, s2, s3, and s4 are four strings, given...Ch. 10.10 - To create the string Welcome to Java, you may use...Ch. 10.10 - What is the output of the following code? String...Ch. 10.10 - Let s1 be Welcome and s2 be welcome Write the...Ch. 10.10 - Prob. 10.10.5CPCh. 10.10 - Prob. 10.10.6CPCh. 10.10 - Prob. 10.10.7CPCh. 10.10 - Prob. 10.10.8CPCh. 10.10 - What is wrong in the following program? 1public...Ch. 10.10 - Show the output of the following code: public...Ch. 10.10 - Show the output of the following code: public...Ch. 10.11 - Prob. 10.11.1CPCh. 10.11 - Prob. 10.11.2CPCh. 10.11 - Prob. 10.11.3CPCh. 10.11 - Prob. 10.11.4CPCh. 10.11 - Prob. 10.11.5CPCh. 10.11 - Suppose s1 and s2 are given as fot tows:...Ch. 10.11 - Show the output of the following program: public...Ch. 10 - (The Time class) Design a class named Time. The...Ch. 10 - (The BMI class) Add the following new constructor...Ch. 10 - (The MyInteger class) Design a class named...Ch. 10 - Prob. 10.4PECh. 10 - (Display the prime factors) Write a program that...Ch. 10 - (Display the prime numbers) Write a program that...Ch. 10 - Prob. 10.7PECh. 10 - Prob. 10.8PECh. 10 - (The Course class) Revise the Course class as...Ch. 10 - Prob. 10.10PECh. 10 - Prob. 10.11PECh. 10 - (Geometry: the Triangle2D class) Define the...Ch. 10 - (Geometry: the MyRectangle 2D class) Define the...Ch. 10 - (The MyDate class) Design a class named MyDate....Ch. 10 - (Geometry: the bounding rectangle) A bounding...Ch. 10 - (Divisible by 2 or 3) Find the first 10 numbers...Ch. 10 - (Square numbers) Find the first 10 square numbers...Ch. 10 - (Mersenne prime)A prime number is called a...Ch. 10 - (Approximate e) Programming Exercise 5.26...Ch. 10 - (Divisible by 5 or 6) Find the first 10 numbers...Ch. 10 - (Implement the String class) The String class is...Ch. 10 - (Implement the String class) The String class is...Ch. 10 - (Implement the Character class) The Character...Ch. 10 - (New string split method) The split method in the...Ch. 10 - (Implement the StringBuilder class) The...Ch. 10 - (Implement the StringBuilder class) The...
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
- Please help me with this , I am stuck ! thanks 1) bagUnion: The union of two bags is a new bag containing the combined contents of the original two bags. Design and specify a method union for the ArrayBag that returns as a new bag the union of the bag receiving the call to the method and the bag that is the method's parameter. The method signature (which should appear in the .h file and be implemented in the .cpp file is: ArrayBag<T> bagUnion(const ArrayBag<T> &otherBag) const; This method would be called in main() with: ArrayBag<int> bag1u2 = bag1.bagUnion(bag2); Note that the union of two bags might contain duplicate items. For example, if object x occurs five times in one bag and twice in another, the union of these bags contains x seven times. The union does not affect the contents of the original bags. Here is the all of the file: ArrayBag.cpp: #include <string>#include "ArrayBag.h" template <class T>ArrayBag<T>::ArrayBag() :…arrow_forward3. (Eliminate duplicates) Write a method that returns a new array by eliminating the duplicate values in the array using the following method header: public static int[] eliminate Duplicates (int[] list) Write a test program that reads in ten integers, invokes the method, and displays the result.arrow_forwardPlease help me with this , I am stuck ! PLEASE WRITE IT IN C++ Thanks 1) bagUnion: The union of two bags is a new bag containing the combined contents of the original two bags. Design and specify a method union for the ArrayBag that returns as a new bag the union of the bag receiving the call to the method and the bag that is the method's parameter. The method signature (which should appear in the .h file and be implemented in the .cpp file is: ArrayBag<T> bagUnion(const ArrayBag<T> &otherBag) const; This method would be called in main() with: ArrayBag<int> bag1u2 = bag1.bagUnion(bag2); Note that the union of two bags might contain duplicate items. For example, if object x occurs five times in one bag and twice in another, the union of these bags contains x seven times. The union does not affect the contents of the original bags. Here is the main file: #include <cstdlib>#include <iostream>#include "ArrayBag.h"using namespace std; template…arrow_forward
- Pls, explain how this program question applies to the code below and comment on it in the program. for example, comment the which part of the question applies to the code and how it worksarrow_forwarddef winning_card(cards, trump=None): Playing cards are again represented as tuples of (rank,suit) as in the cardproblems.pylecture example program. In trick taking games such as whist or bridge, four players each play one card from their hand to the trick, committing to their play in clockwise order starting from the player who plays first into the trick. The winner of the trick is determined by the following rules:1. If one or more cards of the trump suit have been played to the trick, the trick is won by the highest ranking trump card, regardless of the other cards played.2. If no trump cards have been played to the trick, the trick is won by the highest card of the suit of the first card played to the trick. Cards of any other suits, regardless of their rank, are powerless to win that trick.3. Ace is the highest card in each suit.Note that the order in which the cards are played to the trick greatly affects the outcome of that trick, since the first card played in the trick…arrow_forwardInstructions: In the code editor, you are provided with a treasureChestMagic() function which has the following description: Return type - void Name - treasureChestMagic Parameters - an address of an integer Description - updates the value of a certain integer randomly You do not have to worry about how the treasureChestMagic() function works. All you have to do is ask the user for an integer and then call the treasureChestMagic() function, passing the address of that integer you just asked. Finally, print the updated value of the integer inputted by the user. Please create a main code for my function that works with this. This is my code: #include<stdio.h>#include<math.h> void treasureChestMagic(int*); int main(void) { // TODO: Write your code here return 0;} void treasureChestMagic(int *n) { int temp = *n; int temp2 = temp; *n = *n + 5 - 5 * 5 / 5; temp2 = (int) pow(2, 3); if(temp % 3 == 0) { *n = temp * 10; } else if(temp %…arrow_forward
- ANSWER IN JAVA: Write an application that inputs five numbers, each between 10 and 100, inclusive. As each number is read, display it only if it’s not a duplicate of a number already read. Provide for the “worst case,” in which all five numbers are different. Use the smallest possible array to solve this problem. Display the complete set of unique values input after the user enters each new value. NOTE: looking for the output to appear on three lines as shown in the results STANDARD OUTPUT: Enter·an·integer·between·10·and·100:This·is·the·first·time·100·has·been·entered↵ Enter·an·integer·between·10·and·100:Enter·an·integer·between·10·and·100:This·is·the·first·time·10·has·been·entered↵ Enter·an·integer·between·10·and·100:This·is·the·first·time·20·has·been·entered↵ Enter·an·integer·between·10·and·100:The·complete·set·of·unique·values·entered·is:↵ Unique·Value·1:·is·100↵ Unique·Value·2:·is·10↵ Unique·Value·3:·is·20↵arrow_forwarduse javascriptarrow_forward.arrow_forward
- (PLEASE USE JAVA AND JFRAME GUI) Game rules:The game consists of a two-dimensional field of size m × n (game field). Each element ofthe game field is a button with a number assigned to it.Initialization of the game:• The numbers on the buttons of the game field are set to a random digit between 0and 9• The target value is displayed above the game field• The current sum of the numbers displayed on the buttons of the game field is printedbelow the game field• The number of moves to completion is displayed in the upper right corner above thegame field.Playing:The first move is determined by the player by selecting any button (button A) on thegame field.1. The player is allowed to choose a second button (button B) located in the columnor row of the previously selected button (A).2. Upon selecting the second button (B), the value of button (A) is updated accordingto the following formula: A = (AoperationB)mod10.3. The operation for the basic game will be +.4. Decrement the number of moves…arrow_forwardQuestion 2 : (Reverse an array) Write a program Reverse.java that prompts the user to enter ten numbers, reverses an array by copying it to a new array and displays the numbers. The array is an attribute of the main class. Enter 10 elements of T ... 1 2 3 4 5 6 7 8 9 10 10 9 8 7 6 5 4 3 2 1arrow_forwardTotaled columns. (Ending of sentence on attachment) please assist with Java code. Please attachment screenshot of successful output.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,
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,