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.
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.
Step by step
Solved in 3 steps with 4 images