Java: An Introduction to Problem Solving and Programming (8th Edition)
8th Edition
ISBN: 9780134462035
Author: Walter Savitch
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 12, Problem 17E
Program Plan Intro
Revenue of Game Stadium
Program Plan:
- Import required package.
- Define “Main” class.
- Define main function.
- Create object “stadiumName” from “LinkedList” class.
- Create object “gameRevenue” from “LinkedList” class.
- Create object for scanner class.
- Display prompt statement.
- Assign “more_values” to “true”.
- Performs “while” loop.
- Read stadium name from user.
- If stadium name is not equal to “done”, then set “more_values” to “false”.
- Otherwise,
- Read game revenue from user.
- Add “st_name” to “stadiumName” by calling the method “addANodeToStart”.
- Add “game_revenue” to “gameRevenue” by calling the method “addANodeToStart”.
- Create array list for stadium names and game revenue.
- Display prompt statement.
- Read stadium name from user.
- Set “total” to “0.0”.
- Compute total amount of money for given stadium name.
- If “name” is equal to “stadium_name”, then compute total revenue for given name.
- Display total amount of money for given stadium name.
- Define main function.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Write a program that uses an ArrayList of parameter type Contact to store a database of contacts. The Contact class should store the contact's first and last name, phone number, and email address. Add appropriate accessor and mutator methods. Your database program should present a menu that allows the user add a contact, display all contacts, search for a specific contact and display it, or search for a specific contact and give the user the option to delete it. The searches should find any contact where an instance variable contains a target search string. For example, if "elmore" is the search target then any contact where the first name, last name, phone number, or email address contains "elmore" should be returned for display or deletion. Use a "for each" loop to iterate through the ArrayList.
Write a generic class Students.java which has a constructor that takes three parameters – id, name, and type. Type will represent if the student is ‘remote’ or ‘in-person’. A toString() method in this class will display these details for any student. A generic method score() will be part of this class and it will be implemented by inherited classes. Write accessors and mutators for all data points.
Write two classes RemoteStudents.java and InPersonStudents.java that inherits from Student class. Show the use of constructor from parent class (mind you, RemoteStudents have one additional parameter – discussion). Implement the abstract method score() of the parent class to calculate the weighted score for both types of students.
Write a driver class JavaProgramming.java which has the main method. Create one remote
student object and one in-person student object. The output should show prompts to enter individual scores – midterm, finals, ...... etc. and the program will…
This is for python
For this assignment, you will write a program to simulate a payroll application. To that effect, you will also create an Employee class, according to the specifications below. Since an Employee list might be large, and individual Employee objects may contain significant information themselves, we store the Employee list as a linked list.
Employee class:
Attributes
• Employee ID: you can use a string – the ID will contain digits and/or hyphens. The ID must be provided during object construction and there should be no mechanism to change it later.
• Number of hours worked in a week: a floating-point number.
• Hourly pay rate: a floating-point number that represents how much the employee is paid for one hour of work.
• Gross wages: a floating-point number that stores the number of hours times the hourly rate.
Methods
• A constructor (__init__)
• Setter methods as needed.
• Getter methods as needed.
• This class should overload the __str__ or __repr__ methods so that…
Chapter 12 Solutions
Java: An Introduction to Problem Solving and Programming (8th Edition)
Ch. 12.1 - Suppose aList is an object of the class...Ch. 12.1 - Prob. 2STQCh. 12.1 - Prob. 3STQCh. 12.1 - Prob. 4STQCh. 12.1 - Can you use the method add to insert an element at...Ch. 12.1 - Prob. 6STQCh. 12.1 - Prob. 7STQCh. 12.1 - If you create a list using the statement...Ch. 12.1 - Prob. 9STQCh. 12.1 - Prob. 11STQ
Ch. 12.1 - Prob. 12STQCh. 12.2 - Prob. 13STQCh. 12.2 - Prob. 14STQCh. 12.2 - Prob. 15STQCh. 12.2 - Prob. 16STQCh. 12.3 - Prob. 17STQCh. 12.3 - Prob. 18STQCh. 12.3 - Prob. 19STQCh. 12.3 - Write a definition of a method isEmpty for the...Ch. 12.3 - Prob. 21STQCh. 12.3 - Prob. 22STQCh. 12.3 - Prob. 23STQCh. 12.3 - Prob. 24STQCh. 12.3 - Redefine the method getDataAtCurrent in...Ch. 12.3 - Repeat Question 25 for the method...Ch. 12.3 - Repeat Question 25 for the method...Ch. 12.3 - Repeat Question 25 for the method...Ch. 12.4 - Revise the definition of the class ListNode in...Ch. 12.4 - Prob. 30STQCh. 12.5 - What is the purpose of the FXML file?Ch. 12.5 - Prob. 32STQCh. 12 - Repeat Exercise 2 in Chapter 7, but use an...Ch. 12 - Prob. 2ECh. 12 - Prob. 3ECh. 12 - Repeat Exercises 6 and 7 in Chapter 7, but use an...Ch. 12 - Write a static method removeDuplicates...Ch. 12 - Write a static method...Ch. 12 - Write a program that will read sentences from a...Ch. 12 - Repeat Exercise 12 in Chapter 7, but use an...Ch. 12 - Write a program that will read a text file that...Ch. 12 - Revise the class StringLinkedList in Listing 12.5...Ch. 12 - Prob. 12ECh. 12 - Write some code that will use an iterator to...Ch. 12 - Prob. 14ECh. 12 - Write some code that will use an iterator to...Ch. 12 - Prob. 17ECh. 12 - Revise the method selectionSort within the class...Ch. 12 - Repeat the previous practice program, but instead...Ch. 12 - Repeat Practice Program 1, but instead write a...Ch. 12 - Write a program that allows the user to enter an...Ch. 12 - Write a program that uses a HashMap to compute a...Ch. 12 - Write a program that creates Pet objects from data...Ch. 12 - Repeat the previous programming project, but sort...Ch. 12 - Repeat the previous programming project, but read...Ch. 12 - Prob. 9PPCh. 12 - Prob. 10PPCh. 12 - Prob. 11PPCh. 12 - Prob. 12PPCh. 12 - Prob. 13PPCh. 12 - Prob. 14PPCh. 12 - Prob. 15PP
Knowledge Booster
Similar questions
- Write a Java program that simulates a basic library delivery system. The user of the program will beable to add different types of items to library collection. In your program, as the main data structure,use the generic collection class ArrayList to store String references.Create three instances from ArrayList of String references. The first one will store the types, thesecond one will store the items, and the third one will store the owners of the items. The types areexactly the following: "Book", "DVD", "Magazine". The items and their owners will be read fromthe keyboard.Regarding the matching between an item and its owner, the location (index value) of an item in thelist of items will be the same with the location of its corresponding owner in the list of owners.As the next step, create the fourth instance from ArrayList of String references and call this list asitemsDeliveredByOwners. This last list will store String references to indicate the owners ofthe items (such as the…arrow_forwardIn this problem you will fill out three functions to complete the Group ADT and the Diner ADT. The goal is to organize how diners manage the groups that want to eat there and the tables where these groups sit. It is important to take the time to read through the docstrings and the doctests. Additionally, make sure to not violate abstraction barriers for other ADTS, i.e. when implementing functions for the Diner ADT, do not violate abstraction barriers for the Group ADT, and vice versa. # Diner ADT def make_diner (name): """ Diners are represented by their name and the number of free tables they have.""" return [name, 0] def num_free_tables (diner): return diner [1] def name (diner): return diner [0] # You will implement add_table and serve which are part of the Diner ADT # Group ADT def make_group (name): Groups are represented by their name and their status.""" return [name, 'waiting'] |||||| def name (group): return group [0] def status (group): return group [1] def start_eating…arrow_forwardImplement PokerValue as specified in textbook page 417, problem 33(a). Your implementation must include following: 1. At least one ADT type selected from textbook files such as Stack, Queue, Collection and List for storing the poker hand. 2. Use only CardDeck.java to hold deck of cards, and Card.java to represent each card. GUI is not required. 3. Default constructor to create a five-card poker hand from CardDeck.java. Make sure the poker hand is implemented with one of the textbook ADT as set forth above. 4. Overloaded constructor accepts an array of five cards to initialize one poker hand. 5. toString() method outputs in the same format as shown in SampleActualOutput.txt 6. You may add other methods as necessary. 7. Test your PokerValue.java with supplied PokerGame.java. Submit PokerValue.javaarrow_forward
- We have two classes; these classes are "Car" and "Price".The "car" class is a class that keeps the id and price of the car.If the "Price" class is, there will be get / set methods for the segment of the fee (For example Y segment Z segment), the number of cars, and the "Car" class list.In the "Price" class, there should be a print method to add / remove cars to the list and find the ids of Vehicles whose segments are equal to X.The segments are as follows. 0$ -15999$ -> Y Segment16000$-24999$ -> Z Segment25000$-50000$ -> T Segment It is necessary to use "Single Linked List".The program should be written in JAVA.arrow_forwardCreate a class called Student that models a student at Carleton University. A student's state consists of a name (String), id number (int) and a list of grades (array of doubles). Your class must have a constructor that has three input parameters (name, id and grade list) and sets the initial state for the object. Include a toString() method that returns a useful string representation of a student object. The string representation should contain the student's name, ID number, and the number of grades they have recorded (so NOT include all the grades). Include a gradesInRange(double lower, double upper) method that returns the number of grades that this student has that are in the range [lower,upper]. That is, the it returns the number of grades that are greater than or equal to lower and less than or equal to upper. Example Usage: Student s = new Student("cat", 100123987, new double[]{81.2, 93.2, 76,2, 84.6});int num_A_grades = s.gradesInRange(80,100);// assert num_A_grades will be 3arrow_forwardWrite a generic class that stores two elements of the same type and can tell the user which one is the larger between the two. The type of the two elements should be parameterized and the class should have a function called “maxElement” that returns the larger element. write this java codearrow_forward
- We have a parking office class for an object-oriented parking management system using java Implement the following methods for our class Add equals and hashCode methods to any class used in a List. Add a method to the Parking Office to return a collection of customer ids (getCustomerIds) Add a method to the Parking Office to return a collection of permit ids (getPermitIds) Add a method to the Parking Office to return the collection of permit ids for a specific customer (getPermitIds(Customer)) The above methods are not included in the parking office class of our class diagram. I have attached class diagrams with definitions of related classes in our system (i.e car, customer, .....)arrow_forwardCreate a class called Student that models a student at Carleton University. A student's state consists of a name (String), id number (int) and a list of grades (array of double). Your class must have a constructor that has three input parameters (name, id and grade list) and sets the initial state for the object. Include a toString() method that returns a useful string representation of a student object. The string representation should contain the student's name, ID number, and the number of grades they have recorded (so NOT include all the grades). Include a gradesInRange(double lower, double upper) method that returns the number of grades that this student has that are in the range [lower,upper]. That is, the it returns the number of grades that are greater than or equal to lower and less than or equal to upper. Example Usage: double[] grades {81.2, 93.2, 76,2, 84.6, 63.11, 79.8}; Student s new Student("cat", 100123987, grades); s.gradesInRange (80,100); int num_grades_A // assert…arrow_forwardExercise 2. Create a Book class where: Each book contains the following information: book title book Author name, barcode (as fong integers), and book topic. o Implement an appropriate constructor(s) and all necessary get/set methods. Test Book class: o Create diffcrent book objects (at least 5 hooks) and store them in a LinkedList sorted by book barcode value Generate a unique random integer value for the barcode. Iterate through the LinkedList and print out the books' details O Create a second LinkedList object containing a copy of the above LinkedList, but in reverse order.arrow_forward
- In Java, Create Movie class, which has private fields for title, director, rating. It has a constructor to initialize these fields and a toString method for printing movie details. There is also a getRating method to retrieve the movie rating. Create Rating Comparator class which implements the Comparator interface for comparing movies based on their ratings. Create DemoMovies Class. Initialize necessary data structures like LinkedList, TreeMap for rating as key and Movie from Movie class as value, TreeSet, and ProtiyQueue. Use a loop to take user input for movie detailsuntil the user enters 'WWW' as the movie title.Inside the loop, for each movie, create a Movie object, add it to various data structures that is title, director and rating based on the constructor. Add the Movie object to the LinkedList. Add the rating and the object to the TreeMap.Add the rating to the TreeSet.Add the Movie object to the Priority Queue.Display the entered movies. Sort and display Movies by rate by…arrow_forwardWrite a generic class with a type parameter T, which declares a T[] and provides: a. A constructor that initializes T[). b. A method that calculates the average of T[] and then returns it. c. A method that displays the average of T[] on screen. Tis a Number class or a subclass of Number class. Write a GenericTest class that tests your generic class with Integer and Double arrays. You can choose the values of the arrays for testing your generic classarrow_forwardCreate the compareTo method for a class that represents an individual whose first and last names are stored as two Strings. In an alphabetical list of people with last names first and then first names, one individual is "less than" another if they come before the other.(as is typical).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