Question
JAVA : Write a program in Java using eclipse that will first input (read from the console) the name and address of a store. Then
JAVA:
Write a program in Java using eclipse that will first input (read from the console) the name and address of a store. Then it will input the name, quantity, and the price of three products. The name and address of the store and the products name may contain spaces. Output an invoice with the stores name and address on the top right corner followed by the three products in three different lines. In each line display the name, the price, the quantity and the total. You need to calculate the total, which is the price multiplied by the quantity.
You will also need to output the following:
- Subtotal: this is the products total before tax.
- Sales Tax: use 7.625% for the tax rate.
- Total: this is the total after tax.
All prices, totals and subtotal should be displayed in US currency format (e.g., $1,000). The invoice should be formatted in columns with 70 characters for the stores name, 70 characters for the stores address, 30 characters for the products name, 10 characters for the products quantity, 15 characters for products price, and 15 characters for the products total.
Formatting: For the prices, totals and subtotal use NumberFormat class and to display the invoice using columns use printf. Here is how you program should work (Simple input and output are shown in the following screen shot):
Console X sterminated> Invoice Dava Application] 1Librarylava/JavavirtualMachines/idk1.8.0 31.jdk/Contents/Home/bin/java Jan Input store's name: My Electronics Input Store's address: mpls, MN 55116 Enter details of product 1 Name Iphone 6s Plus Price 699.99 Quantity: Enter details of product 2 Name: Smart TV 55 Price 1299.89 Quantity: Enter details of product 3 Name: Raspberry P Price: 35.99 Quantity: My Electronics mpls, MN 55116 Iphone 6s Plus $1,399.98 $699.99 Smart TV 55 $1,299.89 $1,299.89 $35.99 $143.96 Raspberry PI Subtotal $2,843.83 Sales Tax C7.625%D $216.84 Total $3,060.67Step 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