Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I want the answer Question 4 (23+5 Points) Part (1) Define a class with the following specifications: a. The class name is Book with three

I want the answer
image text in transcribed
Question 4 (23+5 Points) Part (1) Define a class with the following specifications: a. The class name is Book with three private data members: title (String), price (double), and discountVoucherNo (int). b. Write a constructor that accepts title, price and discountVoucherNo as input parameters to initializes the private data members. c. Provide an accessor (get) method and a mutator (set) method only for the discountVoucherNo data member. d. Define a private method called isVoucherMatched( ) that returns true if an integer voucher number passed to the method matches the object's discountVoucherNo, otherwise, it should returns false. e. Define a public method called show( ) that requests the user to input a discount voucher and calls the isVoucherMatched() method. The method should display the book title and price (with discount if applicable). If the call to isVoucherMatched( ) method returned true, it should display the price as a discounted value ( 15% less) else the price should be displayed as it is. See Sample Below Question 4 (23+5 Points) Part (1) Define a class with the following specifications: a. The class name is Book with three private data members: title (String), price (double), and discountVoucherNo (int). b. Write a constructor that accepts title, price and discountVoucherNo as input parameters to initializes the private data members. c. Provide an accessor (get) method and a mutator (set) method only for the discountVoucherNo data member. d. Define a private method called isVoucherMatched( ) that returns true if an integer voucher number passed to the method matches the object's discountVoucherNo, otherwise, it should returns false. e. Define a public method called show( ) that requests the user to input a discount voucher and calls the isVoucherMatched() method. The method should display the book title and price (with discount if applicable). If the call to isVoucherMatched( ) method returned true, it should display the price as a discounted value ( 15% less) else the price should be displayed as it is. See Sample Below

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

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

More Books

Students also viewed these Databases questions

Question

12-5 How will MIS help my career?

Answered: 1 week ago