SCIT
School of Computing and Information Technology
Spring 2019 Programming Fundamentals
Assignment 3 (10 marks)
Due Time and Date:
23:59 on Friday, 18 October Objectives
This assignment requires you to create one program in Java to simulate a Point-of-Sale (POS) system.
General Requirements:
You should create your programs with good programming style and form using proper blank spaces, indentation and braces to make your code easy to read and understand;
You should create identifiers with sensible names;
You should make comments to describe your code segments where they are necessary for
readers to understand what your code intends to achieve.
Logical structures and statements are properly used for specific purposes.
Other requirements as stated in Submission section.
Read the assignment specification carefully, and make sure that you follow whatever
directed in this assignment. In every assignment that you will submit in this subject, you must put the following information in the header of your assignment:
/**
* CSIT111 or CSIT811 Assignment 2
*
* Student name:
* Student user ID:
* Student number:
*/
NOTE: Please indicate your subject code either CSIT111 or CSIT811 as different requirements are assessed.
Program Requirements
You create the main program called POSmain.java and two classes: ShoppingCart and CashRegister.
Programming Fundamentals 1/4
Your POSmain program should take three file names from command line arguments. The first file contains a list of products and their prices; the second and third files are lists of items in two shopping carts of two customers. The POSmain program should first read the price file, then read each of the cart files to load a list of items in a shopping cart and store them in a ShoppingCart objects. The price file may contain a variable number of products and the cart files may contain a variable number of items.
POSmain then will create a CashRegister object by passing the price list to it. The POSmain program then will use the CashRegister object to scan items in a cart and print a receipt for each shopping cart one by one. At last, POSmain will use the CashRegister object to print a report for the day.
The students of CSIT111 and CSIT811 will print a different report for the day, which requires different design of your CashRegister class.
Program Output For CSIT111 students:
One customer is checking out ======================================== Product Price Qty Subtotal –
Bed
Char
TV
Table
$499.99 2 $45.49 4 $999.99 1 $199.0 2
$999.98
$181.96
$999.99
$398.0
–
Total $2579.93
========================================
One customer is checking out ======================================== Product Price Qty Subtotal –
Bread
Butter
Ham
Lettuce
Milk
Onions
Tomato
$1.75 2 $3.5 $2.84 1 $2.84 $2.5 1 $2.5 $1.0 1 $1.0 $3.0 2 $6.0 $0.54 3 $1.62 $0.76 5 $3.8
–
Total $21.26
======================================== Report for the day ======================================== Number of customers: 2
Total sale: $2601.19
List of products sold: – Product Qty – Bed 2
Bread 2
Butter 1
Char 4
Ham 1
Lettuce 1
Programming Fundamentals
2/4
Milk 2 Onions 3 TV 1 Table 2 Tomato 5
For CSIT811 students:
One customer is checking out ======================================== Product Price Qty Subtotal –
Bed
Char
TV
Table
$499.99 2 $45.49 4 $999.99 1 $199.0 2
$999.98
$181.96
$999.99
$398.0
–
Total $2579.93
========================================
One customer is checking out ======================================== Product Price Qty Subtotal –
Bread
Butter
Ham
Lettuce
Milk
Onions
Tomato
$1.75 2 $3.5 $2.84 1 $2.84 $2.5 1 $2.5 $1.0 1 $1.0 $3.0 2 $6.0 $0.54 3 $1.62 $0.76 5 $3.8
–
Total $21.26
======================================== Report for the day ======================================== Number of customers: 2
Total sale: $2601.19
List of products sold: – Product Qty – Bed 2
Bread 2
Butter 1
Char 4
Ham 1
Lettuce 1
Milk 2
Onions 3
TV 1
Table 2
Tomato 5
List of products purchased per customer: – Customer 1: – Product Qty – Bed 2
Char 4
TV 1
Table 2 – Customer 2: –
Programming Fundamentals
3/4
Product Qty – Bread 2
Butter 1
Ham 1
Lettuce 1
Milk 2
Onions 3
Tomato 5 –
Submission
Achieve all your source files into a file called a3.zip.
Submit a3.zip file from your University Unix account on Banshee (banshee.uow.edu.au)
as follows:
Submit before the due time:
submit -u YourUnixID -c CSIT111 -a a3 a3.zip
Submit after the due time with AC:
submit -u YourUnixID -c CSIT111 -a a3-late a3.zip
Marking Scheme
Mark to 0.5 divisions.
For CSIT111/811 students
General requirements
-0.5 ~ -1.0 mark for each error
POSmain
3
ShoppingCart
2
CashRegister
5
Programming Fundamentals
4/4
Reviews
There are no reviews yet.