Answered step by step
Verified Expert Solution
Question
1 Approved Answer
GUIDELINES Your source code have the statement at the beginning. package assignment 1 ; In other words do not use default packaging. The source file
GUIDELINES
Your source code have the statement at the beginning.
package assignment;
In other words do not use default packaging.
The source file should have a main method inside.
You will only need to submit one source file, not the whole EclipseIDE project.
You cannot use Collections in Java for this assignment.
You cannot use any other rd party library.
Your code should compile fine. Non compiling submissions will receive a penalty.
Your program should generate EXACTLY the same output if the sample input is given. Please see the sample inputs and outputs. Give importance to number of stars, spaces etc.
Program Description
In this programming assignment, you are tasked with implementing a simple Java program that generates receipts for a fictional store. The program uses random values to create a unique receipt number and date, and it allows users to input items and their prices. The receipt includes details such as the item number, item name, calculated price including tax and the total sum for all items. The output should be printed to the screen.
Requirements:
Random Receipt Number:
Generate a random receipt number between and is exclusive, is inclusive.
Date Generation:
Generate a random date in the format Month Day Year for the receipt.
Year is in between and is exclusive.
The day is between to Both inclusive
Input Handling:
Utilize the Scanner class to take user input for item names and prices.
Continue taking input until the user enters "DONE" for the item name.
Tax Calculation:
If the item is categorized as "Food" or food set the tax rate to
For other items, set the tax rate to
Receipt Details:
Display each item's details, including the item number, name, and calculated price including tax
The first letter of the item should be written in capital. If the user has entered in lowercase, you need to fix it Please check the sample output.
Total Calculation:
Calculate and display the total sum for all items.
Output Formatting:
Use appropriate formatting to create a visually appealing receipt.
Evaluation Criteria:
Your assignment will be evaluated based on the following criteria:
Correct implementation of random receipt number and date generation.
Proper handling of user input and item categorization.
Accurate tax calculation and receipt details display.
Correct total sum calculation.
Code structure, organization, and comments.
Sample Program output
Note that the user input is written with blue.
SAMPLE OUTPUT
S store
receipt number
January
Write item name pencil
Write price
item number Pencil
Write item name pen
Write price
item number Pen
Write item name food
Write price
item number Food
Write item name DONE
items total
ANOTHER SAMPLE OUTPUT
S store
receipt number
April
Write item name Bag
Write price
item number Bag
Write item name food
Write price
item number Food
Write item name DONE
items total
Notes:
There are spaces between items and total
Ex:
itemsXXXXXXtotal
There are spaces between receipt number and the number
Ex:
receipt numberXXXXXX
Besides there is one space between others.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started