Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a new Java project. The application uses an input dialog box. a. Create a class named Purchase. Each Purchase contains an invoice number, amount

Create a new Java project.

The application uses an input dialog box.

a. Create a class named Purchase. Each Purchase contains an invoice number, amount of sale, and amount of sales tax. Include set methods for the invoice number and sale amount. Within the set() method for the sale amount, calculate the sales tax as 5% of the sale amount. Also, include a display method that displays a purchases details. Save the file as Purchase.java.

b. Create an application that declares a Purchase object and prompts the user for purchase details. When you prompt for an invoice number, do not let the user proceed until a number between 1,000 and 8,000 has been entered. When you prompt for a sale amount, do not proceed until the user has entered a nonnegative value. After a valid Purchase object has been created, display the objects invoice number, sale amount, and sales tax. Save the file as CreatePurchase.java.

Sample Output:

image text in transcribed

image text in transcribed

Invoice #1234, Amount of sale: $150.15, Tax: $7.51

- If the user enters invalid invoice number:

image text in transcribed

- Also, create a dialog box for an invalid amount.

Input Enter invoice number 1234 OK Cancel

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_2

Step: 3

blur-text-image_3

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

Sql++ For Sql Users A Tutorial

Authors: Don Chamberlin

1st Edition

0692184503, 978-0692184509

Students also viewed these Databases questions

Question

=+a tadpole into a frog.

Answered: 1 week ago

Question

b. Where did they come from?

Answered: 1 week ago