
The code above provides an example of an interface class. Explain the purpose and advantages of creating interfaces that store related constants.
What will be an ideal response?
The purpose for creating an interface containing constants is to provide a set of data that a number of classes can use without having to redeclare the values. This interface provides a number of constants for a pizzeria. Any class written for the pizzeria can implement this interface and use the permanent values. The PizzaDemo application shows an example that uses each value. The application only needs a declaration for the current special price. All the constants, such as the name of the pizzeria, are retrieved from the interface.
You might also like to view...
Which of the following is not one of the six logical units of a computer?
a. Input unit. b. Output unit. c. Central processing unit. d. Printer.
?A __________ describes how an organization will achieve its vision, mission, objectives, and goals.
Fill in the blank(s) with the appropriate word(s).
Write a program in a class NumberAboveAverage that counts the number of days that the temperature is above average. Read ten temperatures from the keyboard and place them in an array. Compute the average temperature and then count and display the number of days on which the temperature was above average.
What will be an ideal response?
The ____________________ is the location on your computer screen at which you type entries to communicate with the computer's operating system.
Fill in the blank(s) with the appropriate word(s).