Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Modify the main method in the ProductDemo file to give discount ( by calling the reducePrice method ) only to customers who are 6 5

Modify the main method in the ProductDemo file to give discount (by calling the reducePrice method) only to customers who are 65 or older.
Add the code to the ProductDemo file. DO NOT CHANGE the Product.java code.
If the customer is 65 or older, give discount and show the discounted price. If not, show the regular price.
Note*: Use the Scanner object to get the age.
Submit ProductDemo.java and output screenshot.??*****
Write a description of class ProductDemo here.
@author (your name)
@version (a version number or a date)
*/
public class ProductDemo
{
public static void main(String[] args)
{
Product product = new Product("Example Product", 50.0);
System.out.println("Initial Product Details:");
System.out.println("Name: "+ product.getName());
System.out.println("Price: $"+ product.getPrice());
product. reducePrice(5.0);
System.out.println("
Reduced Price:");
System.out.println("Price: $"+ product.getPrice());
}
}
image text in transcribed

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

Data Management Databases And Organizations

Authors: Watson Watson

5th Edition

0471715360, 978-0471715368

More Books

Students also viewed these Databases questions