Java: Introduction to Problem Solving and Programming
Java: Introduction to Problem Solving and Programming
7th Edition
ISBN: 9780133834604
Author: SAVITCH
Publisher: PEARSON
bartleby

Videos

Textbook Question
Book Icon
Chapter 9, Problem 10PP

Suppose that you are in change of customer service for a certain business. As phone calls come in, the name of the caller is recorded and eventually a service representative returns the call and handles the request. Write a class ServiceRequests that keeps track of the names of callers. The class should have the following methods:

  • addName (name)—adds a name to the list of names. Throws a ServiceBackUpException if there is no free space in the list
  • removeName (name)—removes a name from the list Throws a NoServiceRequestException if the name is not in the list.
  • getName (i)—returns the ith name in the 1st.
  • getNumber—returns the current number of service requests.

Write a program that uses an object of type ServiceRequests to keep track of customers that have called. It should have a loop that, in each iteration, attempts to add a name, remove a name, or print all names. Use an array of size 10 as the list of names.

Graphics

Blurred answer
Students have asked these similar questions
????????: Implement the design of the Pizza class so that the following output is produced: [Your code should work for any number of parameters added in the set_toppings_info method] # Write your codes here. print("Pizza Count:", Pizza.pizza_count) print("=======================") p1 = Pizza("Chicken") p1.set_toppings_info(25, 1, 4, 0) p1.display() print("------------------------------------") p2 = Pizza("Olives") p2.set_toppings_info(15, 1.5, 0, 0) p2.display() print("------------------------------------") p3 = Pizza("Sausage") p3.set_toppings_info(50, 5, 2, 0) p3.display() print("=======================") print("Pizza Count:", Pizza.pizza_count) Output: Pizza Count: 0 ======================= Toppings: Chicken 25 calories 1 g fat 4 g protein 0 g carbs ------------------------------------ Toppings: Olives 15 calories 1.5 g fat 0 g protein 0 g carbs ------------------------------------ Toppings: Sausage 50 calories 5 g fat 2 g protein 0 g carbs ======================= Pizza…
pet shop wants to give a discount to its clients if they buy one or more pets and at least five other items. The discount is equal to 20 percent of the cost of the other items, but not the pets.Use a class Item to describe an item, with any needed methods and a constructor public Item(double price, boolean isPet, int quantity)An invoice holds a collection of Item objects; use an array list to store them. In the Invoice class, implement methods public void add(Item anItem)public double getDiscount()Write a program that prompts a cashier to enter each price and quantity, and then a Y for a pet or N for another item. Use a price of –1 as a sentinel. In the loop, call the add method; after the loop, call the getDiscount method and display the returned value.
) Modify the BookStore and BookSearchEngine classes explained in the class to include the following additional methods and test them:a) A method returning the book with the lowest price in the library.b) A method searching the library for Books of a given author and returning an ArrayList of such Books. c) A method returning an ArrayList of Books whose price is less than a given number.

Chapter 9 Solutions

Java: Introduction to Problem Solving and Programming

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
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
6 Stages of UI Design; Author: DesignerUp;https://www.youtube.com/watch?v=_6Tl2_eM0DE;License: Standard Youtube License