Implement an Interface That Extends Another
easyQuestion 531An interface can extend another interface. Priced extends Named, so Priced asks for its own method, getPrice(), and also for getName(), which it inherits from Named. MenuItem says only implements Priced, yet it must supply both. Complete the two methods.
Requirements:
1. getName() returns the name field.
2. getPrice() returns the price in dollars as a double. The class stores the price as a whole number of cents in cents, so 450 cents is 4.5.
3. Divide in a way that keeps the fraction: dividing two whole numbers would drop it.
4. Do not change Named or Priced.
Do NOT write a main method.
Expected output
Soup 4.5 Soup
= newline. The output ends with a newline, so print one after the last line.
Hints2 available
Sign in to use hintsTopics
InterfacesClasses
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (sysout, psvm, fori)
Your output
Run your code to see the output here...
Test cases
Run your code to see test case results.