Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
11th Edition
ISBN: 9780134670942
Author: Y. Daniel Liang
Publisher: PEARSON
bartleby

Concept explainers

bartleby

Videos

Textbook Question
Book Icon
Chapter 11, Problem 11.8PE

(New Account class) An Account class was specified in Programming Exercise 9.7. Design a new Account class as follows:

■    Add a new data field name of the String type to store the name of the customer.

■    Add a new constructor that constructs an account with the specified name, id, and balance.

■    Add a new data field named transactions whose type is ArrayList that stores the transaction for the accounts. Each transaction is an instance of the Transaction class, which is defined as shown in Figure 11.6.

Chapter 11, Problem 11.8PE, (New Account class) An Account class was specified in Programming Exercise 9.7. Design a new Account

FIGURE 11.6    The Transaction class describes a transaction for a bank account.

■    Modify the withdraw and deposit methods to add a transaction to the transactions array list.

■    All other properties and methods are the same as in Programming Exercise 0.7.

Write a test program that creates an Account with annual interest rate 1.5%, balance 1000, id 1122, and name George. Deposit $30, $40, and $50 to the account and withdraw $3, $4, and $2 from the account. Print an account summary that shows the account holder name, interest rate, balance, and all transactions.

Blurred answer
Students have asked these similar questions
Instructions-Java Assignment is to define a class named Address. The Address class will have three private instance variables: an int named street_number a String named street_name and a String named state. Write three constructors for the Address class: an empty constructor (no input parameters) that initializes the three instance variables with default values of your choice, a constructor that takes the street values as input but defaults the state to "Arizona", and a constructor that takes all three pieces of information as input Next create a driver class named Main.java. Put public static void main here and test out your class by creating three instances of Address, one using each of the constructors. You can choose the particular address values that are used. I recommend you make them up and do not use actual addresses. Run your code to make sure it works.  Next add the following public methods to the Address class and test them from main as you go: Write getters and…
# Coding  - Simulate a robot Write a program that simulates the movements of a robot. The robot can have three possible movements:     turn right    turn left    advance The robot is placed on a hypothetical infinite grid, facing a particular direction (north, east, south, or west) at a set of `{x,y}` coordinates,e.g., `{3,8}`, with coordinates increasing to the north and east. Create a Class `Robot` that contains a method `execute` which given a number of instructions will calculate the robot's new position, and the the direction in which it is pointing. ## Example The letter-string "RAALAL" means:     Turn right    Advance twice    Turn left    Advance once    Turn left yet again Say a robot starts at `{7, 3}` facing north. Running this stream of instructions should leave it at `{9, 4}` facing west. ## Inputs and Outputs The argument of the `execute` is `string` in the format `X Y BEARING COMMANDS`. The method should return a one-liner `string` in the format `X Y BEARING`. In the…
LocalResource(String date, String sector)- Actions of the constructor include accepting a date in the format “dd/mm/yyyy”, initializing the base class, storing the sector and storing an id as a consecutively increasing integer. Note that the constructor must ensure that the date of birth information is recorded. b. getId():Integer - returns the ID of the current instance of LocalResource c. getSector():String – returns the sector associated with the current instance of localResource d. getTRN():String – returns the trn number of the current instance of LocalResource. The process used to determine the TRN is to add the id to the number 100000000 and then returning the string equivalent. e. Update the NineToFiver class to ensure it properly extends the LocalResource class f. In method getContact() of NineToFiver, remove the comments so that the method returns "Local Employee #"+and the id of the contact. Write a concrete class LocalConsultant that extends LocalResource, and implements…

Chapter 11 Solutions

Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)

Ch. 11.5 - Identify the problems in the following code:...Ch. 11.5 - Prob. 11.5.2CPCh. 11.5 - If a method in a subclass has the same signature...Ch. 11.5 - If a method in a subclass has the same signature...Ch. 11.5 - If a method in a subclass has the same name as a...Ch. 11.5 - Prob. 11.5.6CPCh. 11.7 - Prob. 11.7.1CPCh. 11.8 - Prob. 11.8.1CPCh. 11.8 - Prob. 11.8.2CPCh. 11.8 - Can you assign new int[50], new Integer [50], new...Ch. 11.8 - Prob. 11.8.4CPCh. 11.8 - Show the output of the following code:Ch. 11.8 - Show the output of following program: 1public...Ch. 11.8 - Show the output of following program: public class...Ch. 11.9 - Indicate true or false for the following...Ch. 11.9 - For the GeometricObject and Circle classes in...Ch. 11.9 - Suppose Fruit, Apple, Orange, GoldenDelicious, and...Ch. 11.9 - What is wrong in the following code? 1public class...Ch. 11.10 - Prob. 11.10.1CPCh. 11.11 - Prob. 11.11.1CPCh. 11.11 - Prob. 11.11.2CPCh. 11.11 - Prob. 11.11.3CPCh. 11.11 - Prob. 11.11.4CPCh. 11.11 - Prob. 11.11.5CPCh. 11.12 - Correct errors in the following statements: int[]...Ch. 11.12 - Correct errors in the following statements: int[]...Ch. 11.13 - Prob. 11.13.1CPCh. 11.14 - What modifier should you use on a class so a class...Ch. 11.14 - Prob. 11.14.2CPCh. 11.14 - In the following code, the classes A and B are in...Ch. 11.14 - In the following code, the classes A and B are in...Ch. 11.15 - Prob. 11.15.1CPCh. 11.15 - Indicate true or false for the following...Ch. 11 - Sections 11.211.4 11.1(The Triangle class) Design...Ch. 11 - (Subclasses of Account) In Programming Exercise...Ch. 11 - (Maximum element in ArrayList) Write the following...Ch. 11 - Prob. 11.5PECh. 11 - (Use ArrayList) Write a program that creates an...Ch. 11 - (Shuffle ArrayList) Write the following method...Ch. 11 - (New Account class) An Account class was specified...Ch. 11 - (Largest rows and columns) Write a program that...Ch. 11 - Prob. 11.10PECh. 11 - (Sort ArrayList) Write the following method that...Ch. 11 - (Sum ArrayList) Write the following method that...Ch. 11 - (Remove duplicates) Write a method that removes...Ch. 11 - (Combine two lists) Write a method that returns...Ch. 11 - (Area of a convex polygon) A polygon is convex if...Ch. 11 - Prob. 11.16PECh. 11 - (Algebra: perfect square) Write a program that...Ch. 11 - (ArrayList of Character) Write a method that...Ch. 11 - (Bin packing using first fit) The bin packing...
Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Introduction to Classes and Objects - Part 1 (Data Structures & Algorithms #3); Author: CS Dojo;https://www.youtube.com/watch?v=8yjkWGRlUmY;License: Standard YouTube License, CC-BY