Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
3rd Edition
ISBN: 9780134038179
Author: Tony Gaddis, Godfrey Muganda
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Chapter 18, Problem 9MC
Program Description Answer
The character “?” is represents a wildcard element in generic type notation.
Hence, the correct answer is option “D”.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
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:…
In python Tuples can contain elements mixed from different types.
True or false?
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…
Chapter 18 Solutions
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Ch. 18.1 - Prob. 18.1CPCh. 18.1 - When ArrayList is used as a non-generic class, why...Ch. 18.1 - Suppose we use the following statement to...Ch. 18.1 - Assume we have used the statement shown in...Ch. 18.2 - Prob. 18.5CPCh. 18.2 - Prob. 18.6CPCh. 18.2 - Prob. 18.7CPCh. 18.2 - Prob. 18.8CPCh. 18.3 - Prob. 18.9CPCh. 18.3 - Prob. 18.10CP
Ch. 18.3 - Prob. 18.11CPCh. 18.3 - Prob. 18.12CPCh. 18.3 - Prob. 18.13CPCh. 18.3 - Prob. 18.14CPCh. 18.4 - Prob. 18.15CPCh. 18.5 - Prob. 18.16CPCh. 18.5 - Prob. 18.17CPCh. 18.6 - Prob. 18.18CPCh. 18.6 - Prob. 18.19CPCh. 18.6 - Prob. 18.20CPCh. 18.8 - Prob. 18.21CPCh. 18.8 - Prob. 18.22CPCh. 18.9 - Prob. 18.23CPCh. 18.9 - During the process of erasure, when the compiler...Ch. 18.9 - Prob. 18.25CPCh. 18 - Prob. 1MCCh. 18 - Prob. 2MCCh. 18 - Look at the following method header: void...Ch. 18 - Look at the following method header: void...Ch. 18 - Look at the following method header: void...Ch. 18 - Look at the following method header: void...Ch. 18 - Prob. 7MCCh. 18 - Prob. 8MCCh. 18 - Prob. 9MCCh. 18 - The process used by the Java compiler to remove...Ch. 18 - True or False: It is better to discover an error...Ch. 18 - Prob. 12TFCh. 18 - True or False: Type parameters must be single...Ch. 18 - Prob. 14TFCh. 18 - Prob. 15TFCh. 18 - True or False: You cannot create an array of...Ch. 18 - Prob. 17TFCh. 18 - Prob. 18TFCh. 18 - Prob. 1FTECh. 18 - Assume the following is a method header in a...Ch. 18 - public class MyClassT { public static void...Ch. 18 - public class PointT extends Number super Integer {...Ch. 18 - Assume there is a class named Customer. Write a...Ch. 18 - Assume names references an object of the...Ch. 18 - Prob. 3AWCh. 18 - Prob. 4AWCh. 18 - Prob. 5AWCh. 18 - Prob. 6AWCh. 18 - Prob. 7AWCh. 18 - Prob. 1SACh. 18 - Look at the following method header: public T...Ch. 18 - Prob. 3SACh. 18 - Do generic types exist at the bytecode level?Ch. 18 - Prob. 5SACh. 18 - When the compiler encounters a class, interface,...Ch. 18 - Prob. 1PCCh. 18 - Prob. 2PCCh. 18 - Prob. 3PCCh. 18 - Prob. 4PCCh. 18 - Prob. 5PCCh. 18 - Prob. 6PCCh. 18 - Prob. 7PC
Knowledge Booster
Similar questions
- continue from first question, Client class:The client program will allow entry of these data for several different student into an ArrayList and then perform some analysis and queries.Your client class (program) will provide the user with a menu to perform the following operations. You will also need to load the information of the students from a CSV file (student.csv) before displaying the menu. You only need one ArrayList and one menu for this. For the csv file, your first item can be U or G to differentiate whether the entry is creating a UndergraduateStudent object, or a GraduateStudent object. You can then decide how you want other data to be listed in the csv file. You should specify clearly in your documentation the data format of the CSV files used in this assignment.1. Quit (exit the program)2. Add (to the ArrayList) all the marks information about an undergraduate or graduate student by reading it from another CSV file. Your program will ask for the file name.3. Given student…arrow_forwardcode: public class PasswordGeneratorAndStorage {/*** Adds an application to the applications ArrayList. If index is -1, add application* to the end of applications. Else is index is within the size of applications, add* application at that index in applications. Otherwise, return. However, if applications * or application is null, return.* * @param applications* @param application* @param index*/public static void addApplication(ArrayList<String> applications, String application, int index) {// TODO: FILL IN BODY}/*** Generates a random password of length passwordLength and adds it to the end of* passwords if index is -1, or adds it to the index of passwords if index is within the* size of passwords (similar to how the addApplication adds an application). To generate* the random password, use rand to generate a random int within the size of characters. You* can then use this int to grab the char at that index in characters and concatenate that* to your String password variable.…arrow_forwardQUESTION 12 Write a method called CompareAndChangeList to be included in an application class called ListApplication that accepts two parameters list1 and list2 of type SingleLinkedList of integer values, and a third parameter Item of type int. If list1 and list2 are of different sizes, the method returns false, otherwise, the method replaces any element in list2 with a value equal to the last element in list1, if the summation of the element in list 1 and the corresponding element in list2 is equal to item. Assume list1 and list2 are not empty. If at least one replacement happened, the method returns true, otherwise, it returns false. Note: Write this method by calling methods of the class SingleLinkedList. Method head public static boolean CompareAndChangeList (SingleLinkedList list1, SingleLinkedList list2, int item) Example: Before Method call: item = 35 list1: 23 26 30 20 17 list2: 10 9. 25 15 4. After Method call: list1: 23 26 30 20 17 list2: 10 17 25 17 4 In this case, the…arrow_forward
- Explain the functionality of each line of code in the provided C# scripts- using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI; public class Healthbar : MonoBehaviour{ [SerializeField] private Health playerHealth; [SerializeField] private Image totalHealthbar; [SerializeField] private Image currentHealthbar; private void Start() { totalHealthbar.fillAmount = playerHealth.currentHealth / 10; } private void Update() { currentHealthbar.fillAmount = playerHealth.currentHealth / 10; }} using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.SceneManagement; public class Health : MonoBehaviour{ [SerializeField] private float startingHealth; public float currentHealth { get; private set; } private Animator anim; private void Awake() { currentHealth = startingHealth; anim = GetComponent<Animator>(); } public void…arrow_forwardMCQ: in java, Which of the following syntax is true with respect to generic declaration: methodModifiers returnType methodName(methodParameters) methodModifiers < > returnType methodName(methodParameters) methodModifiers <genericParameters> returnType methodName (methodParameters) <genericParameters> methodModifiers returnType methodName(methodParameters)arrow_forwardThe StateManager Interface is a generic interface which has two methods changeState (boolean : status). This method is used to change the status of InvoiceItem and PrescriptionItem. The possible status for InvoiceItem can be (Available – true or Unavailable - false), whereas PrescriptionItem has status (Recommended-true or Prohibited – false) passed to the method as an argument. The reset () method sets the default value for both InvoiceItem and PrescriptionItem. The Item class is self-explanatory. It implements the StateManager interface, and has toString method which prints the information in the following format. "Item Name: <<name>> (<<id>>)” e.g. Item Name: Panadol (223) Two classes PrescriptionItem and InvoiceItem are inherited from Item class representing the items that can be sold with doctor’s prescription and without prescription respectively with following functionalities: The constructors of PrescriptionItem and InvoiceItem initialize fields to…arrow_forward
- Project 1b: Create a Flights Database using ArrayList of Objects For this Lab assignment, you will create an ArrayList of Java Objects, populate them and print out the results. Specifically, you will create an ArrayList of type Flight (ArrayList<Flight>). A Flight contains an attribute of type AircraftType, which is modeled above. An AircraftType contains an engineType attribute which is an enumeration type called EngineType. Steps to create this project: You should study the modules relating to ArrayLists, ArrayList of Objects SimpleDateFormat, and Java Enums. Create a new project in IntelliJ called for example FlightArrayList and a class FlightArrayList. Follow the pattern in the ArrayLists of Objects module page. Create the classes Flight and AircraftType and the EngineType enumeration as modeled above. For simplicity, these can be inner classes (Links to an external site.) of your public main class FlightArrayList. Flight and AircraftType should have…arrow_forwardCreate three static comparators: one that compares points based on their x, y, and distance from the origin; the other two compare points based on any Point2D data type. For the Point2D data type, create two non-static comparators: one that compares objects based on how far they are from a given point, and the other that compares objects based on how far they are from a given point polarly.arrow_forwardUsing the provided Book class in the file hw05_q2.py, create a container class called ShoppingList to store a list of books for a semester's worth of classes. Your ShoppingList class should primarily consist of a list of Book objects and should support the following methods: Constructor that takes a list of course designators (eg., "CSCI 1133") and creates a list of Book objects using the provided constructor in the Book class and the book information in the file catalog.py. Your constructor should have the signature __init__(self, courses). Overloaded addition operator that allows you to add Book objects to a ShoppingList using '+' Overloaded subtraction operator that allows you to remove Book objects from a ShoppingList using '-' A get_total_price() function that returns a sum of the prices of all books on the shopping list. You should use the same catalog list for testing as you used in problem 1. Save your ShoppingList class in the same hw05_q2.py file as the provided Book…arrow_forward
- instruction: php code po ang needarrow_forwardWhich of the following is an example (or examples) of a correct way to use a generic type? (you may select zero, one, or more answers) a. ArrayList b. ArrayList Oc. ArrayListarrow_forwardThe shape class variable is used to save the shape of the forestfire_df dataframe. Save the result to ff_shape. # TODO 1.1 ff_shape = print(f'The forest fire dataset shape is: {ff_shape}') todo_check([ (ff_shape == (517,13),'The shape recieved for ff_shape did not match the shape (517, 13)') ])arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education