Programming Questions Based On Classes

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Programming Questions Based On Classes as PDF for free.

More details

  • Words: 278
  • Pages: 1
Programming Questions based on classes 1) Assume that a bank maintains two kinds of accounts for its customers, one called “savings account” and other “checking account”. The savings account provides compound interest and withdrawal facilities. The checking account provides cheque book facility, the customer should maintain a minimum balance of 500$. If the balance for a customer falls below this amount, a service charge of 5$ is imposed on that account. The accounts contain following information: Customer Account Number Customer Name Customer Type : C or S or both. Constructor method for initializations. Other methods depending on your choices. 2) Create a class “Computer” that stores information about different types of computers available with a dealer. The information to be stored about a single computer is, a. Company Name. b. RAM size. c. Hard Disk Capacity. d. Processor speed. e. Price. f. Quantity of computers. The class contains the following methods, -

-

-

Constructor method that assigns user input values to above mentioned variables. Main() method that creates an array of 4 objects of computer class and that takes input for all the above details from the user and calls method to check validity of Quantity and Price values. If all values are valid then create the objects and display the details. Method that checks the validity of quantity and price. If the quantity is 0 or negative then method should throw user defined exception with appropriate message and exit out of the program. Similarly if the price is 0 or negative then it should throw user defined exception with appropriate message and exit the program. Method that displays all details about a single instance of computer.

Related Documents