logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

On program start, each inventory item’s data is read from the inventory file, placed in a new item class object, which is then placed in the inventory ArrayList

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS
  1. Assignment Details

Model a simple point of sale system that behaves as follows when it is run.

  • On program start, each inventory item’s data is read from the inventory file, placed in a new item class object, which is then placed in the inventory ArrayList.

 

  • The user is then presented with a menu of items that can be selected. The user can then chose to

 

  • select an item from the inventory to place in a shopping cart (also an ArrayList).

 

  • The user is presented with a list of available items and makes one selection. The menu of items shown to the user is generated from the ArrayList of inventory

 

  • The item selected is placed in the users cart ArrayList and subtracted from quantity on hand in the inventory ArrayList.

 

  • The user may chose to not select an item to place in the

 

  • take an item out of the cart ArrayList and return it to the inventory ArrayList.

 

  • The user is presented with the contents of the

 

  • The user can select one item to return to the inventory or may chose to keep the contents of the cart “as is”.

 

  • check out, i. e. leave with the items. This triggers

 

  • printing (to the terminal) of a receipt listing the cart. This includes the name and cost of each item, plus the total cost of all items. If there are no items in the cart, a receipt is not printed. I. e. the user just

 

  • emptying of the cart ArrayList after the receipt is

 

  • replacement of the data in the inventory file with the data currently in the inventory

ArrayList. I. e. the inventory file is updated so that it is correct.

 

  • When the user leaves (stops shopping), the next user can elect to shop or halt the

 

 

  1. Assignment Requirements
    • You will create the initial inventory text file in order to test your program. (Some example file organizations are shown on the next page.) The inventory file you create for testing your program must

 

  • contain data on at least 5

 

  • be stored in the main folder (directory) of your IntelliJ project. This will allow you to load the file just by using the file’s name instead of a full or relative path) and the file will be included in the ZIP archive that you

 

  • contain three pieces of data for each each inventory item. These are the quantity on hand, the price of the item and the name of the

 

  • You will create the item class. The item class must

 

  • store all the data about an item (quantity on had, price, name) as private fields (data members)

 

  • contain constructors, getters and other methods as necessary, such as to manipulate quantity on hand by adding one or subtracting one.

 

  • not allow a name that is null or of length

 

  • not allow a price that is less than zero.

 

  • not allow the quantity on hand to be less than zero.

 

  • At program start, all items in the inventory file are read and placed in the inventory ArrayList as objects of the item

 

  • The menu of items that can be selected by the user is generated from the item class objects referenced in the inventory ArrayList.

 

  • The user can select one item at a time to place in the cart. The inventory in the ArrayList must be kept up to date as the user selects an item and places it in the cart. The menu must be kept up to date as the user selects an item. I. e. if the quantity on hand becomes zero, the menu should not show that item.

 

  • No item may be placed in a cart if that item has a quantity of zero in the

Some Example File Organizations

Example 1:

item1­name item1­price item1­quantity item2­name item2­price item2­quantity item3­name item3­price item3­quantity

...

 

Example 2:

item1­quantity item1­price item1­name item2­quantity item2­price item2­name item3­quantity item3­price item3­name

...

 

Tip:     If you data is on separate lines, that a readLine() that follows a nextInt() or a nextDouble() requires a dummy read to absorb the end of line character that exists after an number.

Additional Requirements

 

  • There is no user I/O (input / output) in the item class. All values given to the fields are either initial values or values passed to parametrized constructors. Values of the fields are returned from the class via

 

  • A reference variable and instance object of class util.Scanner must be used to read user input. A reference variable and instance object of class java.util.Scanner must be used to read input from the file. A refernece variable and instance object of class java.io.PrintWriter must be used for all file output.

 

  • Use of try-with-resources is required for all file input and (d)Identifiers must be descriptive, i. e. must self document.

(e)Indention of all code blocks (compound statements, anything in braces), including single statements following selection or while statements, is required.

(5/5)
Attachments:

Expert's Answer

1552 Times Downloaded

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

1552 Times Downloaded

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

874 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

826 Answers

Hire Me
expert
Husnain SaeedComputer science

893 Answers

Hire Me
expert
Atharva PatilComputer science

869 Answers

Hire Me
April
January
February
March
April
May
June
July
August
September
October
November
December
2025
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
SunMonTueWedThuFriSat
30
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1
2
3
00:00
00:30
01:00
01:30
02:00
02:30
03:00
03:30
04:00
04:30
05:00
05:30
06:00
06:30
07:00
07:30
08:00
08:30
09:00
09:30
10:00
10:30
11:00
11:30
12:00
12:30
13:00
13:30
14:00
14:30
15:00
15:30
16:00
16:30
17:00
17:30
18:00
18:30
19:00
19:30
20:00
20:30
21:00
21:30
22:00
22:30
23:00
23:30