Answered step by step
Verified Expert Solution
Link Copied!

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 assignment1;
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 Eclipse/IDE project.
You cannot use Collections in Java for this assignment.
You cannot use any other 3rd 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 1000 and 2000.2000 is exclusive, 1000 is inclusive.
Date Generation:
Generate a random date in the format (Month Day Year) for the receipt.
Year is in between 1900 and 2100.2100 is exclusive.
The day is between 1 to 28(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 0.
For other items, set the tax rate to 30%.
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 1976
January 141917
Write item name pencil
Write price 15.5
item number 1 Pencil 20.15
Write item name pen
Write price 14.0
item number 2 Pen 18.2
Write item name food
Write price 150
item number 3 Food 150.0
Write item name DONE
3 items total 188.35
******************************
******************************
******************************
ANOTHER SAMPLE OUTPUT
******************************
****** S store ***************
******************************
receipt number 1219
April 211910
Write item name Bag
Write price 27.47
item number 1 Bag 35.711
Write item name food
Write price 140
item number 2 Food 140.0
Write item name DONE
2 items total 175.711
******************************
******************************
******************************
Notes:
There are 6 spaces between items and total
Ex:
2 itemsXXXXXXtotal 56.42
There are 6 spaces between receipt number and the number
Ex:
receipt numberXXXXXX1235
Besides there is one space between others.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

More Books

Students also viewed these Databases questions

Question

How is psychology a science?

Answered: 1 week ago