Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

questions below 1. public class Product { 2. private double price; 3. private String name; 4. private static final double SALESTAX = 7.00; public static

questions below image text in transcribed
image text in transcribed
image text in transcribed
1. public class Product { 2. private double price; 3. private String name; 4. private static final double SALESTAX = 7.00; public static int NumProducts = 0; 5. E 6. public Product (String name, double price) { 7. price price; 8. name = name; 9. NumProducts++; } 10. public String getName() { 11. return name; 1 12. public double getPrice () { 13. return price; } 14. public void reducePrice (double price) { 15. this.price = this.price price; ) 16. public void increasePrice (double price) { 17. this.price = this.price + price; ) 18. public getPriceWithTax() { 19. return + ((SALESTAX/100)*this.price); } } 1. What are the variables in lines 2 and 3 called in Object-Oriented Programs? (1 point) 2. Where is the Constructor? You can mention Line number(s). (1 point) 3. How many arguments does the Constructor accept? (1 point) 4. A. What is the line number where a class variable is declared? (1 point) B. What is the purpose of that class variable in the given code? (1 point) 5. Lines 7 and 8 will cause an error. How can the error be fixed? (2 points) 6. A. Which method(s) is/are called Mutator in the Product class? (1 point) B. Why are they called Mutator? (1 point)

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

More Books

Students also viewed these Databases questions