Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

03-60-21 Ziad Kobti Write and document a Java program that inputs the name (String), quantity (int), and price (double) of three items. The name may

image text in transcribed

03-60-21 Ziad Kobti Write and document a Java program that inputs the name (String), quantity (int), and price (double) of three items. The name may contain spaces. Output a bill with tax rate of 6.25%. All prices should be formatted to two decimal places. The bill should be formatted in columns with 30 characters for the name, 10 characters for quantity, 10 characters for the price, and 10 characters for the total. Sample input and output is shown below. An invoice has a list (array) of items Input name of item 1: lollipos Input Quantity of item 1: 10 input price of item 1: 0.50 Input name of item 2: diet soda Input Quantity of item 2: Invoice Iteml J numitems name quantity input price of item 2: 1.25 Input name of item 3: chocolate bar Input quantity of item 3: 20 input price of item 3: 0.75 Your bill: Item lollipops diet soda chocolate bar Price 0.50 1.25 0.75 Quantity 10 Total 5.00 3.75 15.00 20 Subtotal 6.25% sales tax Total 23.75 1-48 25.23 REQUIREMENTS: To do this code use a class called "Invoice and class "Item with attributes as per the class UML diagram above. Create the necessary constructors, access and utility methods. The main method could be in a separate class holder called "CashRegister". The main instantiates an Invoice and the invoice instantiates the array of 3 items. It then executes the input of each item and the final display, all done in separate methods. Refer to the class example for inspiration on class design concepts

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

Main Memory Database Systems

Authors: Frans Faerber, Alfons Kemper, Per-Åke Alfons

1st Edition

1680833243, 978-1680833249

More Books

Students also viewed these Databases questions