Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
6th Edition
ISBN: 9780134477367
Author: David J. Barnes, Michael Kolling
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Chapter 2, Problem 75E
Explanation of Solution
Given: Parameters that are passed to function are “Henry Moore� and “557214�.
To find: The value which is returned by the getLoginName() method with two parameters that are “Henry Moore�, as the name field and “557214�, as the id field.
Solution:
The method getLoginName() returns “Henr557� as the string type, which is the co...
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
A explanation of the GetConsoleTitle method should be supplied.
The code given below represents a saveTransaction() method which is used to save data to a database from the Java program. Given the classes in the image as well as an image of the screen which will call the function, modify the given code so that it loops through the items again, this time as it loops through you are to insert the data into the salesdetails table, note that the SalesNumber from the AUTO-INCREMENT field from above is to be inserted here with each record being placed into the salesdetails table. Finally, as you loop through the items the product table must be update because as products are sold the onhand field in the products table must be updated. When multiple tables are to be updated with related data, you should wrap it into a DMBS transaction.
The schema for the database is also depicted.
public class PosDAO { private Connection connection; public PosDAO(Connection connection) { this.connection = connection; } public void…
use the RUST
Chapter 2 Solutions
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Ch. 2 - Create a TicketMachine object on the object bench...Ch. 2 - What value is returned if you get the machine's...Ch. 2 - Prob. 3ECh. 2 - Prob. 4ECh. 2 - Create another ticket machine for tickets of a...Ch. 2 - Prob. 6ECh. 2 - Does it matter whether we write...Ch. 2 - Prob. 8ECh. 2 - Put back the word public, and then check whether...Ch. 2 - From your earlier experimentation with the ticket...
Ch. 2 - Prob. 11ECh. 2 - Prob. 12ECh. 2 - Prob. 13ECh. 2 - Prob. 14ECh. 2 - In the following field declaration from the...Ch. 2 - Prob. 16ECh. 2 - Prob. 17ECh. 2 - To what class does the following constructor...Ch. 2 - How many parameters does the following constructor...Ch. 2 - Prob. 20ECh. 2 - Suppose that the class Pet has a field called name...Ch. 2 - Challenge exercise The following object creation...Ch. 2 - Compare the header and body of the getBalance...Ch. 2 - If a call to getPrice can be characterized as...Ch. 2 - If the name of getBalance is changed to getAmount,...Ch. 2 - Prob. 26ECh. 2 - Try removing the return statement from the body of...Ch. 2 - Compare the method headers of getPrice and...Ch. 2 - Do the insertMoney and printTicket methods have...Ch. 2 - Create a ticket machine with a ticket price of...Ch. 2 - How can we tell from just its header that setPrice...Ch. 2 - Complete the body of the setPrice method so that...Ch. 2 - Prob. 33ECh. 2 - Is the increase method a mutator? If so, how could...Ch. 2 - Prob. 35ECh. 2 - Write down exactly what will be printed by the...Ch. 2 - Add a method called prompt to the TicketMachine...Ch. 2 - Prob. 38ECh. 2 - What about the following version?
Ch. 2 - Prob. 40ECh. 2 - Add a showPrice method to the TicketMachine class....Ch. 2 - Create two ticket machines with differently priced...Ch. 2 - Modify the constructor of TicketMachine so that it...Ch. 2 - Give the class two constructors. One should take a...Ch. 2 - Implement a method, empty, that simulates the...Ch. 2 - Prob. 46ECh. 2 - Predict what you think will happen if you change...Ch. 2 - Rewrite the if-else statement so that the method...Ch. 2 - Prob. 49ECh. 2 - In this version of printTicket, we also do...Ch. 2 - Is it possible to remove the else part of the...Ch. 2 - After a ticket has been printed, could the value...Ch. 2 - So far, we have introduced you to two arithmetic...Ch. 2 - Write an assignment statement that will store the...Ch. 2 - Write an assignment statement that will divide the...Ch. 2 - Prob. 56ECh. 2 - Modify your answer to the previous exercise so...Ch. 2 - Why does the following version of refundBalance...Ch. 2 - What happens if you try to compile the...Ch. 2 - What is wrong with the following version of the...Ch. 2 - Add a new method, emptyMachine, that is designed...Ch. 2 - Rewrite the printTicket method so that it declares...Ch. 2 - Challenge exercise Suppose we wished a single...Ch. 2 - List the name and return type of this method:
Ch. 2 - Prob. 65ECh. 2 - Write out the outer wrapping of a class called...Ch. 2 - Write out definitions for the following fields:
Ch. 2 - Write out a constructor for a class called Module....Ch. 2 - Prob. 69ECh. 2 - Correct the error in this method:...Ch. 2 - Write an accessor method called getName that...Ch. 2 - Write a mutator method called setAge that takes a...Ch. 2 - Write a method called printDetails for a class...Ch. 2 - Draw a picture of the form shown in Figure 2.3,...Ch. 2 - Prob. 75ECh. 2 - Create a Student with name "djb" and id "859012"....Ch. 2 - Prob. 77ECh. 2 - Challenge exercise Modify the getLoginName method...Ch. 2 - Consider the following expressions. Try to predict...Ch. 2 - Open the Code Pad in the better-ticket-machine...Ch. 2 - Now add the following in the Code Pad:...Ch. 2 - Add the following: t1.InsertMoney500; What would...Ch. 2 - Prob. 83ECh. 2 - Prob. 84ECh. 2 - Add a field, pages, to the Book class to store the...Ch. 2 - Are the Book objects you have implemented...Ch. 2 - Add a method, printDetails, to the Book class....Ch. 2 - Add a further field, refNumber, to the Book class....Ch. 2 - Modify your printDetai 1 s method to include...Ch. 2 - Prob. 90ECh. 2 - Add a further integer field, borrowed, to the Book...Ch. 2 - Prob. 92ECh. 2 - Prob. 93ECh. 2 - Prob. 94E
Knowledge Booster
Similar questions
- Give some instances from various fields?arrow_forwardWhen the friend tool is used, this is broken. Talk about the many ways that the "your friend" function can be used.arrow_forwardHow to create method in groovy language. Actually I created one but i am getting missonmethod exception. Please help mearrow_forward
- As the first step in writing an application for the local book store, we will design and implement a Book class that will define the data structure of the application. Each book has a name, author, type (paperback, hardback, magazine), integer ID and pageCount. Provide some data validation in the appropriate method to ensure that the ID and pageCount are not negative. Design and implement a Book class with separation, i.e., separate all functions and methods into both the prototype and an implementation below the main. Provide constructor methods for Book(void), Book(name, author), and one for all components Book(name, author, type, ID, pageCount) Provide accessor (get and set) methods for each property as well as a display method. Provide data validation for the ID and pageCount in the appropriate methods. Provide a method to calculate the cost for buying books (with a 7.75% sales tax) according to the following chart: Hardcover: $29.95 per book Paperback:…arrow_forwardHow do I do this using python?arrow_forwardQUESTION 12 What value should the second parameter be in the startsWith method to successfully search for "charlie" in the target string "bravo echo charlie alpha"?arrow_forward
- Get to know about the proof-carrying code, a method in which the provider of mobile code provides an evidence of its security, and the user merely checks the proof rather than creating it (start with the work of Necula [Nec97]). What are the advantages and disadvantages of this approach to sandboxing? What features does it promise to have?arrow_forwardCreate some Student objects. Call the getName method on each object. Explain what is happening.arrow_forwardThank you for the reply. This needs to be done using the Lambda method. CAn you help me with that?arrow_forward
- Requirement: In this assignment, you are going to handle exceptional cases in the bank account class for foreign currencies. In the attached files, source codes for ForeignCurrencyAccount and Account classes are given. There is also Test3.java and Transaction.java that run operations on the bank accounts. Please complete the implementation of ForeignCurrencyAccount and Account classes, so that following exceptional cases are handled by them. Do not add new attributes or methods to ForeignCurrencyAccount and Account classes. Just add code to throw exceptions or handle exceptions. 1. Whenever a transaction amount given to "withdraw" method is greater than account's balance, an exception of class InsufficientFundsException should be thrown. 2. Whenever InsufficientFundsException is caught within buyForeignCurrency or sellForeignCurrency methods, an Exception should be thrown with description "Foreign currency buy/sell transaction failed because of insufficient funds". 3. Whenever…arrow_forwardRequirement: In this assignment, you are going to handle exceptional cases in the bank account class for foreign currencies. In the attached files, source codes for ForeignCurrencyAccount and Account classes are given. There is also Test3.java and Transaction.java that run operations on the bank accounts. Please complete the implementation of ForeignCurrencyAccount and Account classes, so that following exceptional cases are handled by them. Do not add new attributes or methods to ForeignCurrencyAccount and Account classes. Just add code to throw exceptions or handle exceptions. Exceptional cases: 1. Whenever a transaction amount given to "withdraw" method is greater than account's balance, an exception of class InsufficientFundsException should be thrown. 2. Whenever InsufficientFundsException is caught within buyForeignCurrency or sellForeignCurrency methods, an Exception should be thrown with description "Foreign currency buy/sell transaction failed because of insufficient funds".…arrow_forwardAdd a validation function using Javascript that does the following 2 things: validates that password entered by the user and reentered password match. Note that minlength ensures it's a minimum of 8 of characters. Test thoroughly!!! Note that usually you would want to check that password meets some minimum requirements such as it includes both upper and lowercase letters and either a number or special character. In Javascript, we use regular expressions to do this. For this assignments, just make sure the password and reentered password match. validates that the username isn't already taken. Create an array of existing valid usernames. Include Harry, Elizabeth, and Shana.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- New Perspectives on HTML5, CSS3, and JavaScriptComputer ScienceISBN:9781305503922Author:Patrick M. CareyPublisher:Cengage Learning
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Cengage Learning