Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

on netbeans Create an Invoice class that might serve as a receipt for items sold. An Invoice should be defined by the following attributes: productName

on netbeans

Create an Invoice class that might serve as a receipt for items sold. An Invoice should be defined by the following attributes:

productName : String

quantityPurchased : int

pricePerItem : double

Provide getters and setters for each attribute, making sure that:

for the product name, ensure the input string is not empty, but if it is empty set the product name to "Unknown Product".

for the quantity purchased:

the quantity purchase is greater than 1, but less than or equal to 1000.

If the quantity is less than 1 then set the quality to 1

If the quantity is greater than 1000 set the quantity to 1000.

for the price per item:

the price per item must be greater than 10 but less than or equal to 10000

if the price per item is less than 10, set the price to 10.

If the price per item is greater than 10,000 set the price to 10,000.

is land the price per item is greater than 10 and less than 10,000.

Include a method that calculates the invoice amount (i.e., multiplies the quantity by the price per item), then returns the amount as a double value.

Create two overloaded constructors for the Invoice class:

A default, no parameter constructor, that initializes the price per item and quantity to the minimize values.

A parameterized (has parameters) constructor that accepts the price per item and quantity and validates the values are in the valid range [hint: use the setters].

Write Graphical User Interface program that:

Prompts the user for each of the input value.

Calculates the total cost

Displays the total cost of the purchase.

When working on this program ensure to review the Lesson on how to create Graphical User Interfaces and while all the reading is important the Chapter 12 reading will help you with the Graphical User Interface programming techniques. I will also, be demonstrating the techniques in the Live Lecture and through screen captures throughout the week.

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

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago