Define a Java class namely Customer containing: Instance variables:  ⁃ id. A private static instance variable of type integer initialized to 0 (id=0).  ⁃ name: A private instance variable of type string.  ⁃ discount: A private instance variable of type integer initialized to 10 (discount=10).     Methods:  ⁃ A parameterized constructor: a constructor method to initialize the name and the discount instantiated objects, the variable id incremented automatically (id=id+ 1) in each instantiate of an object Customer.  ⁃ setName(xxx): acts as the set method for the attribute name  ⁃ setDiscount(xxx): acts as the set method for the attribute discount (0<= discount<=100).  ⁃ getld: acts as the get method for the attribute id   ⁃ getName(): acts as the get method for the attribute name  ⁃ getDiscount (): acts as the get method for the attribute discount  ⁃ toString(): returns the attributes id, name, and discount (with using the getter methods only) in the following format: id name: discount   Define a Java class namely Invoice containing: Instance variables:  ⁃ idin: A private instance variable of type integer.  ⁃ customer. A private instance variable of type Customer.  ⁃ amount: A private instance variable of type double.     Methods: -full-parameterized constructor: a constructor method to initialize the instantiated objects.   - setCustomer(xxx): acts as the set method for the attribute customer getCustomer (): acts as the get method for the attribute customer   -getAmountAfetrDiscount (): acts as the get method for the amount after the discount {amountAfterDiscount = amount-(amount * discount /100)}   -displayInvoice): display the attributes id, name, and discount of customer and the amount after the discount.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Define a Java class namely Customer containing:

Instance variables:

 ⁃ id. A private static instance variable of type integer initialized to 0 (id=0).

 ⁃ name: A private instance variable of type string.

 ⁃ discount: A private instance variable of type integer initialized to 10 (discount=10).

 

 

Methods:

 ⁃ A parameterized constructor: a constructor method to initialize the name and the discount instantiated objects, the variable id incremented automatically (id=id+ 1) in each instantiate of an object Customer.

 ⁃ setName(xxx): acts as the set method for the attribute name

 ⁃ setDiscount(xxx): acts as the set method for the attribute discount (0<= discount<=100).

 ⁃ getld: acts as the get method for the attribute id 

 ⁃ getName(): acts as the get method for the attribute name

 ⁃ getDiscount (): acts as the get method for the attribute discount

 ⁃ toString(): returns the attributes id, name, and discount (with using the getter methods only) in the following format: id name: discount

 

Define a Java class namely Invoice containing:

Instance variables:

 ⁃ idin: A private instance variable of type integer.

 ⁃ customer. A private instance variable of type Customer.

 ⁃ amount: A private instance variable of type double.

 

 

Methods:

-full-parameterized constructor: a constructor method to initialize the instantiated objects.

 

- setCustomer(xxx): acts as the set method for the attribute customer getCustomer (): acts as the get method for the attribute customer

 

-getAmountAfetrDiscount (): acts as the get method for the amount after the discount {amountAfterDiscount = amount-(amount * discount /100)}

 

-displayInvoice): display the attributes id, name, and discount of customer and the amount after the discount. 

Expert Solution
steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
Developing computer interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education