EBK JAVA PROGRAMMING
9th Edition
ISBN: 9781337671385
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
error_outline
This textbook solution is under construction.
Students have asked these similar questions
Case Problem 1 -
In previous chapters, you developed classes that work with catering event information for Carly’s Catering. Now modify the Event and EventDemo classes as follows:
Modify the Event class to include an integer field that holds an event type. Add a final String array that holds names of the types of events that Carly’s caters—wedding, baptism, birthday, corporate, and other. Include get and set methods for the integer event type field. If the argument passed to the method that sets the event type is larger than the size of the array of String event types, then set the integer to the element number occupied by other. Include a get method that returns an event’s String event type based on the numeric event type.
To keep the EventDemo class simple, remove all the statements that compare event sizes and that display the invitation Strings.
Modify the EventDemo class so that instead of creating three single Event objects, it uses an array of three Event objects. Get data for…
Create a BowlingTeam class
The class has 2 fields: a field for the team name and an array that holds the team members’ names.
Create get and set methods for the teamName field.
Add a setMember method that sets a team member’s name. The method requires a position and a name, and it uses the position as a subscript to the members array.
Add a getMember method that returns a team member’s name. The method requires a value used as a subscript that determines which member’s name to return.
Create a BowlingTeamDemo class. In the main method include the following:
Declare 2 variables: name and a constant NUM_TEAMS that holds 4 Bowling Team objects.
Declare and instantiate an array teams of BowlingTeam objects.
Using nested for loops, prompt the user to enter the 4 team names and enter the team members’ names.
Using another nested for loop, output each team’s name and their team members’.
Output should look like:
Members of team The Lucky Strikes
Carlos
Diego
Rose
Lynn
Members of team I…
Create a player class and a Key class. A Player hasa name, HP, and a key. A character may only have one key at a time, a Key contains a String array that lists the names of all the placed the key can go. The key should have a use() function that takes in a string of what it is trying to be used on, the function will return true if it can be used on that door, and false if it cannot. The player can pick Up and Drop a key.
Knowledge Booster
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
- In Assignment 4, you created a Card class that represents a standard playing card. Use this to design and implement a class called DeckOfCards that stores 52 objects of the Card class using an array. Include methods to shuffle the deck, deal a card, return the number of cards left in the deck, and a toString to show the contents of the deck. The shuffle methods should assume a full deck. Document your design with a UML Class diagram. Create a separate driver class that first outputs the populated deck to prove it is complete, shuffles the deck, and then deals each card from a shuffled deck, displaying each card as it is dealt along with the number of cards left in the deck. Hint: The constructor for DeckOfCards should have nested for loops for the face values (1 to 13) within the suit values (1 to 4) calling the two parameter constructor. The shuffle method does not have to simulate how a deck is physically shuffled; you can achieve the same effect by repeatedly swapping pairs of…arrow_forwardIn Assignment 4, you created a Card class that represents a standard playing card. Use this to design and implement a class called DeckOfCards that stores 52 objects of the Card class using an array. Include methods to shuffle the deck, deal a card, return the number of cards left in the deck, and a toString to show the contents of the deck. The shuffle methods should assume a full deck. Document your design with a UML Class diagram. Create a separate driver class that first outputs the populated deck to prove it is complete, shuffles the deck, and then deals each card from a shuffled deck, displaying each card as it is dealt along with the number of cards left in the deck. Hint: The constructor for DeckOfCards should have nested for loops for the face values (1 to 13) within the suit values (1 to 4) calling the two parameter constructor. The shuffle method does not have to simulate how a deck is physically shuffled; you can achieve the same effect by repeatedly swapping pairs of…arrow_forwardYou are required to design a movie class which has following attributes String title; String Theme; String director; Int rating; String release_Date; Provide default & Parameterized constructors. Provide getters & setters for data members. Provide a toString() method to print values. Now create an array of movies store values in it. After that you have to print the following All the movies. Movies from a director whose name starts with ‘a’; All comedy movies. All the movies released on 2-2-2020. All movies with rating 5.arrow_forward
- Write a program that will contain an array of person class objects. The program should include two classes: 1) One class will be the person class. 2) The second class will be the team class, which contain the main method and the array or array list. The person class should include the following data fields; Name Phone number Birth Date Jersey Number Be sure to include get and set methods for each data field.The team class should contain the data fields for the team, such as: Team name Coach name Conference name The program should include the following functionality. Add person objects to the array; Find a specific person object in the array; (find a person using any data field you choose such as name or jersey number) Output the contents of the array, including all data fields of each person object. (display roster)arrow_forwardQuestion-1: The abstract Animal class has four concrete subclasses named mammals, amphibians, Reptiles, and Birds. Each of these four classes has a different number of legs and weights in kilograms. The weights of each category are 100, 40, 200, 25 KGs respectively. Create six different objects from these four categories, and store them in a one-dimension array. Display the entries in the array and their total weights and legcounts. Question-2 is assigned to even registration numbers Question-2: Write a java program for the course registration using a string array. The number of courses available is B. Name the courses according to your conveyance, initialize a list with the Register numbers of 20 students. Assign the registration numbers randomly from this list to eight courses. The program has to ensure that no student is allowed to register for more than five courses, If a student is registered for more than five-course, throw a textual error message and print the same with the…arrow_forwardTask#1 Create a class called 'Matrix' containing constructor that initializes the number of rows and number of columns of a new Matrix object. The Matrix class has the following information: 1. Number of rows of matrix 2. Number of columns of matrix 3. Elements of matrix in the form of 2D array The Matrix class has methods for each of the following: 1. Get the number of rows 2. Get the number of columns 3. Set the elements of the matrix at given position (i,j) 4. Adding two matrices. If the matrices are not addable, "Matrices cannot be added" will be displayed. 5. Multiplying the two matrices Note : please solve the Question in Java programming thanks ?arrow_forward
- AVA code OVERVI EW This is a review exercise, so the primary goal of the exercise is to get your mind working and in the correct space.In this activity you will create a imaginary grid of locations that goes from −?≤?≤?, −?≤?≤?, with the coordinate (0,0) being "home". On this grid you will keep track of various animal objects as they move around the grid. Make sure that all animals stay within that grid at all timesincluding when they are created. Zwill be the map size and will control the highest number allowed on themap before wraping around. Using Java, create the following classes and primary program that uses the classes that you developed. INS T RUCT IONS Create the following classes. A N I MA L C LA SS Create an Animal class. Each animal has a name, an x and y integer coordinate. The Animal class should have at minimum the following methodsbelowbut you may want to add more if necessary: Also note, everyanimal will need to have to have “z”passed to it so that it knows how big the…arrow_forwardCreate a class called Book. The class will contain data members for name, publisher, author, pages andprice. All the data member should be private, except the price, which is to be public. There should be a display()function to show the contents of each object (Book). Your task is to create ARRAY of 10 objects of Book classin main() and provide different values to each object using getData(). There should be a function isOersize()returning true if the number of pages is greater than 500 otherwise false. Also call this function for each object todisplay the message “Oversized” or “NOT Oversized”. The Details of objects should be displayed as well in themain(). Access data members and/or member functions using Pointer to Book class only. Use only one pointerand assign the base address of array of objects to it. Accessor and mutator should also be highlighted. Alsofind/accumulate the price of all the objects by accessing the price data members of all objects and display the totalprice.…arrow_forwardThis lab was designed to reinforce programming concepts from this lab, you will practice: Declaring and initializing ArrayList. Add elements to the Arraylist. Display the content of the ArrayList. Write a class name PhoneBookEntry that has fields for a person’s name and phone number. The class should have a constructor and the appropriate accessor and mutator methods. Then write a program that creates at least 5 PhoneBookEntry objects and stores them in an ArrayList. Use a loop to display the contents of each object in the ArrayList.arrow_forward
- For each object class include the following: displayPromotion () method which can be used to display the following messages:Video Game: Only certain of video game will be getting 10% discount.Sport Game: Booking court on week days will be getting 15% discount.Overridden toString() method that returns a string containing all the data fields’values.(photo 111) Write a driver program that uses a polymorphic array to store information for various video games and sport games. Use an array initializer to initialize the array with values. Then, display a list with all the game information. A sample output is provided below:(photo 112)arrow_forwardYou are required to design an Movie class which has following attributes String name; String Director; String release_Date; Int duration; Provide default & Parameterized constructors. Provide getters & setters for data members. Provide a toString() method to print values. Now create an array of items store values in it (take values form user). After that you have to print the following All the movies in the array. Movie whose name starts with ‘a’; Movie whose director name end with “m”. All the movies having released on 28-3-2021. Movie with longest duration.arrow_forwardYou are required to design an Movie class which has following attributes String name; String Director; String release_Date; Int duration; Provide default & Parameterized constructors. Provide getters & setters for data members. Provide a toString() method to print values. Now create an array of items store values in it (take values form user). After that you have to print the following All the movies in the array. Movie whose name starts with ‘a’; Movie whose director name end with “m”. All the movies having released on 28-3-2021. Movie with longest duration i want answer in java languagearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
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