Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java code Create a class called Compliments with data member coke 200ml of int type to count the number of complimentary coke and sprite500ml of

image text in transcribed

Java code

Create a class called "Compliments" with data member "coke 200ml" of int type to count the number of complimentary coke and "sprite500ml" of int type to count the number of the complimentary sprite. Create a subclass "Pizza" from Compliments with data member "type" of integer array to count the each purchased pizza type. Create another class called "Customer", which includes the data members "id". "name", "address", "amount" and "object of Pizza". Create a GUI with the following Swing components: A List box to display the name of the pizza along with the prize (Ex: Paneer 50). Text field for each type of pizza to enter the quantity. Three text fields to receive the customer id, name, address. Two buttons with caption "Place-an-order" and "History.". Two text areas for viewing the current purchased details and purchased history (i.e. so far purchased items, so far complimentary items, so far purchased amounts) When user click the "place-an-order" button create a Customer object and initialize the data member as follows "id","name", "address": through text fields. "amount": total amount spent for purchasing(i.e., (selected pizza price * quantity)) Pizza object": the type array, coke200ml and sprite 500ml are initialized as follows type array: The type array should be initialised for the entered quantity of the selected pizzas. coke200ml & sprite 500ml: If purchased amount>R$500 and Rs1000 and Rs1500 then offer a single item of coke and single item of the sprite (i.e. increment coke 200ml by one & increment sprite 500ml by one). When user click the "Place-and-Order" button, create a Customer Object as well as display customer details (id, name, address), current purchased items, compliment details, purchased amount in the first text area, and add the Customer Object to the array list. If the customer is already available in the array list, then update amount, type array, coke200ml, sprite 500ml. (i.e. by adding the current values with already stored values in the array list). When user clicks the "History button, need to show the customer details so far maintained. Exception: While pressing the place-an-order button. If the quantity is not entered for the selected items, throw the user defined exception with the message "Enter quantity for selected items" If the quantity is entered without selecting an item, throw the user defined exception with the message "Select an item first". If customer details (id, name, address) are not entered in the given text fields, throw the user defined exception with the message "Enter customer details. These messages have to be displayed in first text area While pressing "History" button, if customer id is not entered in the corresponding text field then throw user defined exception with message "Enter customer id and this message has to be displayed in second text area. Create a class called "Compliments" with data member "coke 200ml" of int type to count the number of complimentary coke and "sprite500ml" of int type to count the number of the complimentary sprite. Create a subclass "Pizza" from Compliments with data member "type" of integer array to count the each purchased pizza type. Create another class called "Customer", which includes the data members "id". "name", "address", "amount" and "object of Pizza". Create a GUI with the following Swing components: A List box to display the name of the pizza along with the prize (Ex: Paneer 50). Text field for each type of pizza to enter the quantity. Three text fields to receive the customer id, name, address. Two buttons with caption "Place-an-order" and "History.". Two text areas for viewing the current purchased details and purchased history (i.e. so far purchased items, so far complimentary items, so far purchased amounts) When user click the "place-an-order" button create a Customer object and initialize the data member as follows "id","name", "address": through text fields. "amount": total amount spent for purchasing(i.e., (selected pizza price * quantity)) Pizza object": the type array, coke200ml and sprite 500ml are initialized as follows type array: The type array should be initialised for the entered quantity of the selected pizzas. coke200ml & sprite 500ml: If purchased amount>R$500 and Rs1000 and Rs1500 then offer a single item of coke and single item of the sprite (i.e. increment coke 200ml by one & increment sprite 500ml by one). When user click the "Place-and-Order" button, create a Customer Object as well as display customer details (id, name, address), current purchased items, compliment details, purchased amount in the first text area, and add the Customer Object to the array list. If the customer is already available in the array list, then update amount, type array, coke200ml, sprite 500ml. (i.e. by adding the current values with already stored values in the array list). When user clicks the "History button, need to show the customer details so far maintained. Exception: While pressing the place-an-order button. If the quantity is not entered for the selected items, throw the user defined exception with the message "Enter quantity for selected items" If the quantity is entered without selecting an item, throw the user defined exception with the message "Select an item first". If customer details (id, name, address) are not entered in the given text fields, throw the user defined exception with the message "Enter customer details. These messages have to be displayed in first text area While pressing "History" button, if customer id is not entered in the corresponding text field then throw user defined exception with message "Enter customer id and this message has to be displayed in second text area

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

Advanced Database Systems

Authors: Carlo Zaniolo, Stefano Ceri, Christos Faloutsos, Richard T. Snodgrass, V.S. Subrahmanian, Roberto Zicari

1st Edition

155860443X, 978-1558604438

More Books

Students also viewed these Databases questions

Question

4. What sales experience have you had?

Answered: 1 week ago

Question

15-5 How will MIS help my career?

Answered: 1 week ago