Question
JAVA question create a class Cost, that tracks the cost of items. Within Cost, create a public inner (non-static) class, Item, that includes the following:
JAVA question
create a class Cost, that tracks the cost of items. Within Cost, create a public inner (non-static) class, Item, that includes the following:
public class Item { String name; int cost; // in cents public Item(String n, int c) { name = n; cost = c; } public String toString() { return name + " " + cost; } }
Modify your inner Item class so that it implements the Comparable
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started