Object Oriented Programming
NIT2112 Object Oriented Programming
Web page 1
“Espresso N Roll Sandwich Store” Programming Task
Due date: Wednesday 16th of March 2022 at 11:59 PM
*** No late submission ***
Marks: The project is price 40% of the whole unit mark.
You might be to work particular person. You could submit just one copy of the project. Submission particulars are on the finish
of this doc. The project has two elements.
Downside Description
Espresso N Roll is a small-town Sandwich Store in rural Australia. The inhabitants is small so the Sandwich Store
sells solely a small however choose gourmand merchandise. It sells 5 merchandise solely. Every product has a reputation and value.
The programming workforce require to display primary Java programming strategies, particularly utilizing courses
and objects. The goal of this project is to develop a top-down design and to jot down a program for use as a
money register by the Espresso N Roll Sandwich Store.
The project consists of two elements. In Half 1, you might be to jot down a Command Line Interface (CLI) money
register software and in Half 2 you create a Graphical Consumer Interface (GUI) for a similar money register.
Half 1 Utility Necessities
For our Java program simulation, a purchase order transaction is sale and cost of a single product. For every sale,
this system ought to immediate and get a numbered merchandise comparable to the product identify and amount of product
bought. The full value of the acquisition must be calculated and displayed. Then this system ought to ask the
amount of cash paid bythe buyer. The calculated change will likely be displayed in dollars and cents in addition to
the forex denominations in banknotes and cash wanted to make up the change in essentially the most environment friendly manner
For instance, if the quantity of change is $17.35 than the client can be given 1 × ten-dollar banknote, 1 ×
five-dollar be aware, 1 × two-dollar coin, 1 × twenty-cent piece, 1 × ten-cent piece, and 1 × five-cent piece.
On the finish of the day the cashier enters Executed to finish the simulation. This system ought to then show the whole
quantity of gross sales in every of the 5 classes and terminate. The 5 product menu is proven if Determine 1.
Espresso N Roll Menu
Merchandise Identify Value
1. Schnitzel Roll $18.80
2. Fish Roll $17.25
three. Lamb Roll $9.60
four. Ice Cream Roll $6.75
5. Espresso Latte $three.40
6. Executed
AssignmentTutorOnline
Determine 1. Espresso N Roll product menu.
Assessment
This system will likely be launched from the category CoffeeNRoll containing the principle( ) technique. Product is a
sensible choice for a category with details about merchandise on the market within the Espresso N Roll. The value may be set or
up to date by calling setPrice( ) technique of Product class. Additionally, we are going to assemble a category Change to return
the proper change and forex denominations for a specific sale, by calculating the smallest variety of
required $100, $50, $20, $10, $5 banknotes and $2, $1, 50c, 20c, 10c, 5c cash.
NIT2112 Object Oriented Programming
Web page 2
A pattern of an UML class diagrams
(a) The general public class Product
• Product(String identify) //constructor initialises information attributes
• setPrice(int cents) //units Product value in cents.
• addToTotal(int quantity) //provides present sale to complete, recorded in cents
• getName( ) //returns the product identify
• getPrice( ) //returns product’s value in cents
• getTotal( ) //returns day’s gross sales in cents
• reset( ) //reset attributes (required by GUI app solely)
(b) The category Change
• Change( ) // constructor initialises information attributes
• denChange(int quantity) //calculate and retailer forex denominations
• getNotes( ) //returns array of banknote denominations
• getCoins( ) //returns array of coin denominations
(c) The category CoffeeNRoll
• major(String[ ] args) //launch software
Program simulate the Espresso N Roll money register. It is going to deal with all consumer inputs.
The category CoffeeNRoll define is as follows:
import java.util.Scanner;
public class CoffeeNRoll
//finish of sophistication CoffeeNRoll
Knowledge Enter
• Product identify (Schnitzel Roll, Fish Roll, Lamb Roll, Ice Cream Roll, Espresso Latter or Executed). Use
menu’s merchandise quantity to pick the specified product. A separate class can validate and deal with all inputs.
• Amount
• Sum of money obtained from buyer in cents
Output
• Whole quantity of buy = amount * product_price
• Change returned to buyer = quantity tendered – quantity bought)
• Along with the quantity of change, show the variety of hundred-dollar, fifty-dollar, twentydollar, ten-dollar and five-dollar notes, two-dollar cash, one-dollar cash, fifty-cent, twenty-cent,
ten-cent and five-cent cash.
• Use printf( ) to align on proper (proper justify) the menu’s value column.
• On the finish of the day (menu merchandise 6. Executed entered) show the whole dollars of gross sales for every of the
5 product classes and totals for the day.
Word: All cash information will likely be saved in cents however displayed as dollars.cents. This avoids rounding issues.
All information enter ought to request the cent worth. (That is really what occurs with an actual money register when
the cashier enters 2000 for $20 then hits “00 key” supplied on the keyboard for greenback entry. Should you tender
$20.50 the cashier enters 2050.
Change
– notes[ ] : int
– cash[ ] : int
– different attributes
+ Change( )
+ denChange(int) : void
+ getNotes( ) : int[]
+ getCoins( ) : int[]
+ different strategies
Product
– identify : String
– value : int
– complete : int
– different attributes
+ Product(int)
+ setPrice(int) : void
+ addToTotal(int) : void
+ getName( ) : String
+ getPrice( ) : String
+ getTotal( ) : int
+ different strategies
NIT2112 Object Oriented Programming
Web page three
A pattern output
≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
──────────────────────────────────
1. Schnitzel Roll $18.80
2. Fish Roll $17.25
three. Lamb Roll $14.60
four. Ice Cream Roll $6.75
5. Espresso Latte $three.40
6. Executed
──────────────────────────────────
Enter the merchandise quantity you need to order: 1
Enter amount ordered: three
Sale value: $56.40
Enter the quantity paid in cents [0-1000000]: 10035
The change is: $43.95
The change returned to the client is:
──────────────────────────────────
| Variety of 20 greenback notes: 2 |
| Variety of 2 greenback cash: 1 |
| Variety of 1 greenback cash: 1 |
| Variety of 50 cents cash: 1 |
| Variety of 20 cents cash: 2 |
| Variety of 5 cents cash: 1 |
──────────────────────────────────
≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
──────────────────────────────────
1. Schnitzel Roll $18.80
2. Fish Roll $17.25
three. Lamb Roll $14.60
four. Ice Cream Roll $6.75
5. Espresso Latte $three.40
6. Executed
──────────────────────────────────
Enter the merchandise quantity you need to order: 5
Enter amount ordered: eight
Sale value: $27.20
Enter the quantity paid in cents [0-1000000]: 5000
The change is: $22.80
The change returned to the client is:
──────────────────────────────────
| Variety of 20 greenback notes: 1 |
| Variety of 2 greenback cash: 1 |
| Variety of 50 cents cash: 1 |
| Variety of 20 cents cash: 1 |
| Variety of 10 cents cash: 1 |
──────────────────────────────────
Sale 1
Sale 2
NIT2112 Object Oriented Programming
Web page four
≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
──────────────────────────────────
1. Schnitzel Roll $18.80
2. Fish Roll $17.25
three. Lamb Roll $14.60
four. Ice Cream Roll $6.75
5. Espresso Latte $three.40
6. Executed
──────────────────────────────────
Enter the merchandise quantity you need to order: 1
Enter amount ordered: 2
Sale value: $37.60
Enter the quantity paid in cents [0-1000000]: 5055
The change is: $12.95
The change returned to the client is:
──────────────────────────────────
| Variety of 10 greenback notes: 1 |
| Variety of 2 greenback cash: 1 |
| Variety of 50 cents cash: 1 |
| Variety of 20 cents cash: 2 |
| Variety of 5 cents cash: 1 |
──────────────────────────────────
≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
──────────────────────────────────
1. Schnitzel Roll $18.80
2. Fish Roll $17.25
three. Lamb Roll $14.60
four. Ice Cream Roll $6.75
5. Espresso Latte $three.40
6. Executed
──────────────────────────────────
Enter the merchandise quantity you need to order: three
Enter amount ordered: three
Sale value: $43.80
Enter the quantity paid in cents [0-1000000]: 11075
The change is: $66.95
The change returned to the client is:
──────────────────────────────────
| Variety of 50 greenback notes: 1 |
| Variety of 10 greenback notes: 1 |
| Variety of 5 greenback notes: 1 |
| Variety of 1 greenback cash: 1 |
| Variety of 50 cents cash: 1 |
| Variety of 20 cents cash: 2 |
| Variety of 5 cents cash: 1 |
──────────────────────────────────
Sale three
Sale four
NIT2112 Object Oriented Programming
Web page 5
≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
──────────────────────────────────
1. Schnitzel Roll $18.80
2. Fish Roll $17.25
three. Lamb Roll $14.60
four. Ice Cream Roll $6.75
5. Espresso Latte $three.40
6. Executed
──────────────────────────────────
Enter the merchandise quantity you need to order: four
Enter amount ordered: 7
Sale value: $47.25
Enter the quantity paid in cents [0-1000000]: 10000
The change is: $52.75
The change returned to the client is:
──────────────────────────────────
| Variety of 50 greenback notes: 1 |
| Variety of 2 greenback cash: 1 |
| Variety of 50 cents cash: 1 |
| Variety of 20 cents cash: 1 |
| Variety of 5 cents cash: 1 |
──────────────────────────────────
≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
──────────────────────────────────
1. Schnitzel Roll $18.80
2. Fish Roll $17.25
three. Lamb Roll $14.60
four. Ice Cream Roll $6.75
5. Espresso Latte $three.40
6. Executed
──────────────────────────────────
Enter the merchandise quantity you need to order: 6
Whole Schnitzel Roll Gross sales: $94.00
Whole
Whole Fish Roll Gross sales:
Lamb Roll Gross sales: $zero.00
$43.80
Whole Ice Cream Roll Gross sales:
Whole Espresso Latte Gross sales: $47.25
$27.20
──────────
$212.25
Whole Day by day Gross sales:
Finish of the day
Gross sales abstract
Finish of day buying and selling
Sale 5
NIT2112 Object Oriented Programming
Web page 6
Half 2: GUI Utility
Design a GUI software to handle the Espresso N Roll sandwich store. The GUI wants to have the ability to accomplish
the identical enter and output duties because the command line pushed program was in a position to do.
The looks of the GUI is totally as much as you to resolve. Be at liberty so as to add any further options that you simply really feel are
helpful.
Word: Don’t rewrite any of the courses from Half 1 of the project. Fairly you’ll create situations of the
related courses whenever you want them for Half 2. The GUI for this project ought to create not less than two new
courses one being the JFrame and the opposite CashRegGUI JPanel with its parts.
Select GUI parts that scale back consumer errors and supply a suggestions to the consumer. For instance,
Variety of 100 greenback notes: 2
Variety of 50 greenback notes: 2
Variety of 20 greenback notes: 2
Variety of 10 greenback notes: 2
Variety of 5 greenback notes: 2
Variety of 2 greenback cash: 1
Variety of 1 greenback cash: 1
three
Paid (cents) 10035
─────────────────────────────────
1. Schnitzel Roll $18.80
2. Fish Roll $17.25
three. Lamb Roll $14.60
four. Ice Cream Roll $6.75
5. Espresso Latte $three.40
─────────────────────────────────
Amount
Change $43.95
Whole Day by day Gross sales: $212.25
Whole Schnitzel Roll Gross sales: $94.00
Whole Fish Roll Gross sales: $zero.00
Whole Lamb Roll Gross sales: $43.80
Whole Ice Cream Roll Gross sales: $47.25
────────
Whole Espresso Latte Gross sales: $27.20
Reset Executed
Sale value $56.40
Espresso N Roll Money Register
Determine 2. Primary Money Register GUI software format
Contemplate the next controls at the least necessities as proven in Determine 2:
• Reset button to clear and allow all fields. complete for every product set zero. Don’t clear product costs!
• Executed button lists day buying and selling abstract in Cell 6 textual content space.
• Textual content subject to show warnings and consumer errors (pink background textual content subject in Sub-Cell 1, in Figuew 2).
• Sale, Amount, Paid and Change textual content subject show sale value, product amount, money tendered and alter.
• Two textual content space to show denomination of change (Cell four) and day buying and selling abstract (Cell 6).
import javax.swing.*;
//Create JFrame container
public class CNR_GUI
public static void major(String[] args) //finish of major
//finish CNR_GUI
JFrame container divided
as GridLayout(three, 2)
Cell 5 panel subdivided
as GridLayout(5, 1)
Cell 1 panel subdivided
as GridLayout(2, 1)
Sub-cell 1
2 three four 5
Cell 2 Cell 1
Cell three, Product identify and
value as button labels Cell four
Cell 6
Cell three. Use JButtons to
choose product or
superior GUI with radio
buttons
NIT2112 Object Oriented Programming
Web page 7
Full marks will likely be given for a totally useful primary format however further marks could also be given by higher
working GUI.
Determine three. Display picture of the totally working Java GUI software (free inventory picture of the vintage money
register from https://www.pexels.com)
Submission Particulars and Marking Scheme
It’s obligatory that you simply display your work to your lab teacher in Session 11. Submission of the
project with code and different deliverables (discuss with ‘What you must hand in’ part beneath) are due on
Wednesday 16th of March 2022 at 11:59 PM. Emailed submissions won’t be accepted.
*** Late submission won’t be accepted besides as outlined beneath***
The late assignments will likely be penalized four marks per day till the submission deadline. Nevertheless, when you have
a great motive for not ending on time, chances are you’ll apply to VU for a time extension particular consideration.
What do you must hand in?
An digital copy of
Readme.docx file with data on tips on how to run your program. Embrace any further details about
your design and program that you simply want the marker to know.
NIT2112 Object Oriented Programming
Web page eight
A phrase doc with the proof of trial runs of your program, i.e., jGRASP console output for CLI
app or display screen printouts of GUI outcomes the place you may have examined all of the options of your code.UML
diagram for all courses in your program.
Code for all of the courses that has been compiled and are able to run. (jGRASP or NetBeans will likely be used to
run and check your software)
A short description of the category. Firstly of every technique, there must be a remark clearly describing
what the strategy does. Every class must be totally documented commencing with a heading. In
explicit, the heading ought to embrace your identify, unit, project particulars, date written and a
temporary description of the category. Firstly of every technique, there must be a remark clearly
describing what the strategy does.
Trace: Begin Early! Don’t underestimate the period of time wanted to jot down and check this system, nor the
complexity of this project.
NIT2112 – Task
Identify………………………….. Identify…………………………..
ID No………………………. ID No……………………….
Markers Guideline
Allotted
Marks Mark
achieved
Acceptable design together with UML class diagrams and outline of
tips on how to resolve the issue plus readme.docs file.
Printout of in depth trial runs 10
class Product — design and implementation 10
class Change — design and implementation 10
Different courses for CLI software — useability and implementation. 10
class CashRegGUI Home windows software — design and implementation.
Another courses. 15
Output & Performance — program works and meets specification.
Entire Program
• Originality, consumer friendliness and presentation.
• Acceptable commenting of code and readability of the code. 25
Demo