Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
4th Edition
ISBN: 9780134787961
Author: Tony Gaddis, Godfrey Muganda
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Chapter 10, Problem 16MC
Program Description Answer
Abstract methods must be “overridden”.
Hence, the correct answer is option “A”.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
This is object oriented programming
1. Write an app that computes student average2. Create a class called Student3. Use the init () function to collect the student information: name, math, science, and English grade4. Create a method (class function) that computes the average5. Create another method that outputs (similarly to) the ff when calledName: John Math: 90Science: 90English: 90Average: 90 (Passed)6. Instantiate a Student object and utilize the defined methods***Let the user input that student info
Software Requirements:
• Latest version of NetBeans IDE
• Java Development Kit (JDK) 8
Procedure:
1. Create a public class named Monday. This class shall contain the main method.
2. Define an interface (without a modifier) named Alarm. This interface shall contain two (2) void
methods named setAlarm() and showAlarm(). The setAlarm() method has a String parameter
named time.
3. Add two (2) classes without modifiers named Weekday (abstract) and Monday.
4. For the Weekday class, implement the Alarm interface. Leave this class empty.
5. Set Weekday as the parent of Monday. Import Scanner from java.util and LocalTime from
java.time. For showAlarm(), add these two (2) statements:
LocalTime alarm = LocalTime .parse(time);
LocalTime now = LocalTime.now();
Explanation: parse() converts String to time, while now() obtains the current time.
7. The output shall ask the user to enter the time for the alarm. If the time entered is past the current
time, then display "Alarm is set for tomorrow!";…
Chapter 10 Solutions
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Ch. 10.1 - Here is the first line of a class declaration....Ch. 10.1 - Look at the following class declarations and...Ch. 10.1 - Class B extends class A. (Class A is the...Ch. 10.2 - Prob. 10.4CPCh. 10.2 - Look at the following classes: public class Ground...Ch. 10.3 - Under what circumstances would a subclass need to...Ch. 10.3 - How can a subclass method call an overridden...Ch. 10.3 - If a method in a subclass has the same signature...Ch. 10.3 - If a method in a subclass has the same name as a...Ch. 10.3 - Prob. 10.10CP
Ch. 10.4 - When a class member is declared as protected, what...Ch. 10.4 - What is the difference between private members and...Ch. 10.4 - Why should you avoid making class members...Ch. 10.4 - Prob. 10.14CPCh. 10.4 - Why is it easy to give package access to a class...Ch. 10.6 - Look at the following class definition: public...Ch. 10.6 - When you create a class, it automatically has a...Ch. 10.7 - Recall the Rectangle and Cube classes discussed...Ch. 10.8 - Prob. 10.19CPCh. 10.8 - If a subclass extends a superclass with an...Ch. 10.8 - What is the purpose of an abstract class?Ch. 10.8 - If a class is defined as abstract, what can you...Ch. 10.9 - Prob. 10.23CPCh. 10.9 - Prob. 10.24CPCh. 10.9 - Prob. 10.25CPCh. 10.9 - Prob. 10.26CPCh. 10.9 - Prob. 10.27CPCh. 10.9 - Prob. 10.28CPCh. 10 - In an inheritance relationship, this is the...Ch. 10 - In an inheritance relationship, this is the...Ch. 10 - This key word indicates that a class inherits from...Ch. 10 - A subclass does not have access to these...Ch. 10 - This key word refers to an objects superclass. a....Ch. 10 - In a subclass constructor, a call to the...Ch. 10 - The following is an explicit call to the...Ch. 10 - A method in a subclass that has the same signature...Ch. 10 - A method in a subclass having the same name as a...Ch. 10 - These superclass members are accessible to...Ch. 10 - Prob. 11MCCh. 10 - With this type of binding, the Java Virtual...Ch. 10 - This operator can be used to determine whether a...Ch. 10 - When a class implements an interface, it must...Ch. 10 - Prob. 15MCCh. 10 - Prob. 16MCCh. 10 - Abstract classes cannot ___________. a. be used as...Ch. 10 - You use the __________ operator to define an...Ch. 10 - Prob. 19MCCh. 10 - Prob. 20MCCh. 10 - You can use a lambda expression to instantiate an...Ch. 10 - True or False: Constructors are not inherited.Ch. 10 - True or False: in a subclass, a call to the...Ch. 10 - True or False: If a subclass constructor does not...Ch. 10 - True or False: An object of a superclass can...Ch. 10 - True or False: The superclass constructor always...Ch. 10 - True or False: When a method is declared with the...Ch. 10 - True or False: A superclass has a member with...Ch. 10 - True or False: A superclass reference variable can...Ch. 10 - True or False: A subclass reference variable can...Ch. 10 - True or False: When a class contains an abstract...Ch. 10 - True or False: A class may only implement one...Ch. 10 - True or False: By default all members of an...Ch. 10 - // Superclass public class Vehicle { (Member...Ch. 10 - // Superclass public class Vehicle { private...Ch. 10 - // Superclass public class Vehicle { private...Ch. 10 - // Superclass public class Vehicle { public...Ch. 10 - Write the first line of the definition for a...Ch. 10 - Look at the following code, which is the first...Ch. 10 - Write the declaration for class B. The classs...Ch. 10 - Write the statement that calls a superclass...Ch. 10 - A superclass has the following method: public void...Ch. 10 - A superclass has the following abstract method:...Ch. 10 - Prob. 7AWCh. 10 - Prob. 8AWCh. 10 - Look at the following interface: public interface...Ch. 10 - Prob. 1SACh. 10 - A program uses two classes: Animal and Dog. Which...Ch. 10 - What is the superclass and what is the subclass in...Ch. 10 - What is the difference between a protected class...Ch. 10 - Can a subclass ever directly access the private...Ch. 10 - Which constructor is called first, that of the...Ch. 10 - What is the difference between overriding a...Ch. 10 - Prob. 8SACh. 10 - Prob. 9SACh. 10 - Prob. 10SACh. 10 - What is an. abstract class?Ch. 10 - Prob. 12SACh. 10 - When you instantiate an anonymous inner class, the...Ch. 10 - Prob. 14SACh. 10 - Prob. 15SACh. 10 - Employee and ProductionWorker Classes Design a...Ch. 10 - ShiftSupervisor Class In a particular factory, a...Ch. 10 - TeamLeader Class In a particular factory, a team...Ch. 10 - Essay Class Design an Essay class that extends the...Ch. 10 - Course Grades In a course, a teacher gives the...Ch. 10 - Analyzable Interface Modify the CourseGrades class...Ch. 10 - Person and Customer Classes Design a class named...Ch. 10 - PreferredCustomer Class A retail store has a...Ch. 10 - BankAccount and SavingsAccount Classes Design an...Ch. 10 - Ship, CruiseShip, and CargoShip Classes Design a...
Knowledge Booster
Similar questions
- JAVA programming languagearrow_forward5. CODE IN PYTHON Create a BankAccount class which has an __init__ method which accepts an account name and starting balance to store as instance fields. The class should also have a method to deposit money, a method to withdraw money, and a method called "get_balance" which returns a string of the format "{account_name} has a balance of {balance}" (do not print this out from within the class, just return the string). In the same file, create an instance of the BankAccount class with a hardcoded name and starting balance. Deposit any amount to the account and withdraw any amount from the account (both can be hardcoded) and then print the result of calling the get_balance method on the instance.arrow_forwardlang : JAVAarrow_forward
- This quiestions involves GroceryChains which store a list of GroceryStore objects. You are to complete the following tasks. /** * A class for a grocery store. Complete the following tasks: * * - Implement a constructor that takes in initial values for each item type * - Add a method that adds inventory of a given type * - Add a method that returns the inventory of a given type */ public class GroceryStore { // A set of possible items at the grocery store public enum GroceryItem {LETTUCE, TOMATO, CUCUMBER} private int lettuceInventory; private int tomatoInventory; private int cucumberInventory; private String name; // Implement a grocery store constructor which takes in a store name, and initial // amounts for each of the inventory types public GroceryStore(String name, int lettuce, int tomato, int cucumber) { //-----------Start below here. To do: approximate lines of code = 4 // //-----------------End here. Please do not remove this comment. Reminder: no changes outside the todo…arrow_forwardD: A 21. The method finalize automatically executes when the class object goes out ofI Scope. 22. A mutator method ofa class changes the values of the data members of the class. 23. In Java, the reference this is used to refer to only the methods. not the instance variables of a class.arrow_forwardSHORT JAVA CODE only requested methods etc.arrow_forward
- Please see attached:)arrow_forwardin Java, 1. Write a class called Counter that has the following:- Data field counterIndex- Default constructor: initializes data field to zero- Overloaded constructor: parameter passed to initialize the data field- Write a getCounterIndex method: returns the counterIndex - Write a setCounterIndex method: sets the counterIndex to some value that is passed to the method- increase method: increase the data field by 1- decrease method: decrease the data field by 1 2. Write a CounterTest programWrite a main method that contains the following:- Create a Counter object called counter1 using the default constructor- - Create a Counter object called counter2 using the overloaded constructor and pass the value 5- Get the counter index for each object and store the values in integer variables a and b- Test if a is greater than b increase counter1, otherwise decrease counter1- Print the counter1 value after the testarrow_forwardPython Code: Write a class called Person with a constructor that takes two arguments, name and age and the saves these as attributes Write a method in this called print_person that prints out this information the console Confirm that you did it properly by instantiating an object called p1 and calling the method on the object. Lastly, extend the constructor by adding functionality that checks the input name only contains letters (no numbers allowed).arrow_forward
- What method is automatically executed whenever a new instance of the class, which the method belongs to, has been instantiated? a. encapsulation b. abstraction c. polymorphismarrow_forwardwith java please as soon as possible Write a class named Triangle with the following data members: - Height - Base -static member area -static member count and with the following methods: - A method named SetMeasurement which accepts two numbers to initialize height and base and add one to count. - A method named GetArea which returns the area of the Triangle as(0.5&height*base) - A method named Display which print out Triangle information. - Create three object from Triangle class and call the method SetMeasurement and Display after each time you create an object.arrow_forwardQUESTION 7 A special method that is executed automatically when the class is instantiated. a. Getter O b. Setter O c. Initializer O d. Constructorarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT