write java codes

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter4: More Object Concepts
Section: Chapter Questions
Problem 2PE
icon
Related questions
Topic Video
Question

write java codes

Create a class named Calculate.
Add 2 instance variables, Quantity and UnitPrice. UnitPrice can include
Rupees and Cents.
Add a no-argument constructor.
Add getters and setters for the 2 instance variables.
Add a user defined method named Total with no arguments. Total will
calculate and return Quantity*UnitPrice. If Quantity is greater than 10, give
5% discount.
Add a user defined method to display the total amount to the user.
Create a Java Main application to create 2 objects based on the Calculate
class to test the program.
Transcribed Image Text:Create a class named Calculate. Add 2 instance variables, Quantity and UnitPrice. UnitPrice can include Rupees and Cents. Add a no-argument constructor. Add getters and setters for the 2 instance variables. Add a user defined method named Total with no arguments. Total will calculate and return Quantity*UnitPrice. If Quantity is greater than 10, give 5% discount. Add a user defined method to display the total amount to the user. Create a Java Main application to create 2 objects based on the Calculate class to test the program.
Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Instruction Format
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
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT