Question
Question asked by Filo student
12. Define a class called BookFair with the following description: Instance variables/Data members: String Bname : stores the name of the book double price : stores the price of the book Member Methods: (i) BookFair() : constructor to initialize data members (ii) void input() : to input and store the name and price of the book (iii) void calculate( ) : to calculate the price after discount. Discount is calculated based on the following criteria:
Price | Discount |
---|---|
Less than or equal to | of price |
More than and less than or equal to | of price |
More than | of price |
Found 6 tutors discussing this question
Discuss this question LIVE
12 mins ago
One destination to cover all your homework and assignment needs
Learn Practice Revision Succeed
Instant 1:1 help, 24x7
60, 000+ Expert tutors
Textbook solutions
Big idea maths, McGraw-Hill Education etc
Essay review
Get expert feedback on your essay
Schedule classes
High dosage tutoring from Dedicated 3 experts
Students who ask this question also asked
Question 1
Views: 5,255
Stuck on the question or explanation?
Connect with our SBI Examinations tutors online and get step by step solution of this question.
231 students are taking LIVE classes
Question Text | 12. Define a class called BookFair with the following description: Instance variables/Data members:
String Bname : stores the name of the book
double price : stores the price of the book
Member Methods:
(i) BookFair() : constructor to initialize data members
(ii) void input() : to input and store the name and price of the book
(iii) void calculate( ) : to calculate the price after discount. Discount is calculated based on the following criteria:
(iv) void display( ) : to display the name and price of the book after discount Write a main method to create an object of the class and call the above member methods.
[ICSE 2016] |
Updated On | Jan 12, 2023 |
Topic | Computer fundamental |
Subject | SBI Examinations |
Class | Class 11 |
Answer Type | Video solution: 1 |
Upvotes | 150 |
Avg. Video Duration | 5 min |