Q: write a complete Java programming Define a Java class namely Customercontainıng: Instance variables: id.A private staticinstance variable of type integer initialized to 0 (7=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. setNarme(xxx) acts as the set method for the attribute narme setDiscount(xx) acts as the set method for the attribute discount (O<= discounte=100). getldo 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 toStringo 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(xx) acts as the set method for the attribute customer getCustomer () acts as the get method for the attribute customer getAmountAfetrDiscount ) acts asthe get method for the amount after the discount (amountAfterDiscount = amount-(amount *discount /100)} displaylnvoice) display the attributes id, name, and discount of customer and the amount after the discount. Define a Java class TestCustomerthat contains a main method as flowing: Crcate an objects of type Customer Name of object discount лате Cus1 Ali +20 Cus2 Saleh -10 Create an objects of type invoice Name of object idin Customer amount Inv Cust 200.85 Print the data of the object Invwith the use of displaylnvoice()method After running the program, what is the value of the attribute id of the cbject cus2 After running the program, what is the value of the attribute discount of the object cus2 To turn the Invoiceclass into an immutable class we need to:

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Q: write a complete Java programming
Define a Java class namely Customercontainıng:
Instance variables:
id. A private staticinstance variable of type integer initialized to 0 (=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 narme
setDiscount(ccx). acts as the set method for the attribute discount (0<= discount<=100).
getldo 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
toString0 returns the attributes id name, and discount(with using the getter methods only in the
following format: id.name.discount
Define a Java clasa 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(x) acts as the set method for the attribute customer
getCustomer (). acts as the get method for the attribute customer
getAmountAfetrDiscount ). acts asthe get method for the amount after the discount
(amountAfterDiscount = amount-(amount *discount /100)}
displaylnvoice) display the attributes id, name, and discount of customer and the amount after
the discount.
Define a Java class TestCustomerthat contains a main method as flowing:
Crcate an objecto of type Customer
Name of object
лате
discount
Cus1
Ali
+20
Cus2
Saleh
-10
Create an objects of type invoice
Name of object
idin
Customer
amount
Inv
Cust
200.85
Print the data of the object Invwith the use of displayinvoice()method
After running the program, what is the value of the attribute id of the dbject cus2
After running the program, what is the value of the attribute discount of the object cus2
To turn the Invoiceclass into an immutable class we need to:
Transcribed Image Text:Q: write a complete Java programming Define a Java class namely Customercontainıng: Instance variables: id. A private staticinstance variable of type integer initialized to 0 (=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 narme setDiscount(ccx). acts as the set method for the attribute discount (0<= discount<=100). getldo 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 toString0 returns the attributes id name, and discount(with using the getter methods only in the following format: id.name.discount Define a Java clasa 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(x) acts as the set method for the attribute customer getCustomer (). acts as the get method for the attribute customer getAmountAfetrDiscount ). acts asthe get method for the amount after the discount (amountAfterDiscount = amount-(amount *discount /100)} displaylnvoice) display the attributes id, name, and discount of customer and the amount after the discount. Define a Java class TestCustomerthat contains a main method as flowing: Crcate an objecto of type Customer Name of object лате discount Cus1 Ali +20 Cus2 Saleh -10 Create an objects of type invoice Name of object idin Customer amount Inv Cust 200.85 Print the data of the object Invwith the use of displayinvoice()method After running the program, what is the value of the attribute id of the dbject cus2 After running the program, what is the value of the attribute discount of the object cus2 To turn the Invoiceclass into an immutable class we need to:
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY