Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

DatatypeNameDescription
HashMapitemCollectionProvides the list of items in the system or the cart depending on which class initiates it

The following constructor must be implemented:

DescriptionInput 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 getItemCollection(){

        // 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

Step: 1

Heres the implementation of the abstract class TheSystem according to the requirements provided impo... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Analyzing Data And Making Decisions Statistics For Business Microsoft Excel 2010 Updated

Authors: Judith Skuce

2nd Edition

9780132844727, 013292496X, 132844729, 978-0132924962

More Books

Students also viewed these Programming questions