Question: sample.txt contains data in (double space) separated value format: pizza very cheesy 12.30 3 salad cobb salad 15.50 12 hunger burger huge patty 9.49 10
sample.txt contains data in (double space) separated value format:
pizza very cheesy 12.30 3
salad cobb salad 15.50 12
hunger burger huge patty 9.49 10
fried chicken so crispy 18.99 5
An abstract class TheSystem should contain the private instance variable specified in TABLE 2 with associated GETTER and SETTER.
TABLE 2:
| Datatype | Name | Description |
| HashMap | itemCollection | Provides the list of items in the system or the cart depending on which class initiates it |
The following constructor must be implemented:
| Description | Input Parameters |
This This constructor initializes the itemCollection variable with an empty hashmap.. It then checks if the AppSystem is invoking the constructor (getClass().getSimpleName().equals("AppSystem")), if so, it adds the items from the sample.txt file to the itemCollection.
Recommended: When reading from the sample.txt file, read each line and do the following line: String[] itemInfo = line.split("\s "); | None |
package com.example;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.HashMap;
import java.util.Scanner;
public abstract class TheSystem {
TheSystem() {
// Your code here
}
public HashMap
// Your code here
}
public Boolean checkAvailability(Item item) {
// Your code here
}
public Boolean add(Item item) {
// Your code here
}
public Item remove(String itemName) {
// Your code here
}
public abstract void display();
}
Step by Step Solution
3.18 Rating (146 Votes )
There are 3 Steps involved in it
Heres the implementation of the abstract class TheSystem according to the requirements provided impo... View full answer
Get step-by-step solutions from verified subject matter experts
