Sei sulla pagina 1di 6

SkillAssure Learning Solutions

OO Programming 1. A trainer trains many trainees on a given technology in this course, which contains many modules each module is comprised of different units and each unit has many topics. a. Identify the different classes from the above problem statement b. Identify the relationship between these classes 2. A company sells different items to customers who have placed orders. An order can be placed for several items. However, a company gives special discounts to its registered customers. a. Identify the different classes from the above problem statement b. Identify the different connections (relationships) between the above classes 3. Write a program to implement the below mentioned requirement a. Class Employee with the following data members and methods i. Data empID : string empName : string address : Address ii. Methods Set methods and get methods for the data members b. The class Address has the following i. Data addr1 : string addr2 : string city : string pin : string ii. Methods set and get methods c. The class EmployeeDemo with a main and two methods i. storeData() which takes the Employee object as an argument Accepts user input for employee data and sets the data on the object ii. showData() which takes an Employee object as the argument and displays the data from the object d. Create an instance of the Employee object and pass the same to the storeData() and showData()

Pratian Technologies (India) Pvt. Ltd

Page 1

SkillAssure Learning Solutions

4. Write a program to implement the below mentioned requirement a. Customer Class i. Data customerId : int custName: String regionCode: String ii. Methods Get and set methods b. Order class i. Data orderId: int customer: Customer orderType: String item: Item ii. Methods Set and get methods c. Item class i. Data ItemNo: int Quantity: int Rate: double total: double ii. Methods Get and set methods d. OrderDemo class i. main() - Create Order object ii. storeCustomerData() Pass order object and fill it with customer data iii. storeOrderData() Pass order object fill it with order data iv. storeItemData() Pass Order object, Add item data v. showOrderData() Display order, item and customer information by passing the order object, also display the total order value 5. Write a class Rectangle with data members, double length and double breadth. Write a parameterized constructor which takes the length and breadth as parameters and assigns it to the instance variables. Write a method area() which calculates the area and returns the same

Pratian Technologies (India) Pvt. Ltd

Page 2

SkillAssure Learning Solutions

6. Constructor chaining a. Write a class Customer i. Data members custId: String custName: String address: Address ii. Methods Write a parameterized constructor which takes custId , custName and address as input and assigns the same to the instance variables get methods for all the instance variables. b. Write a class Address i. Data members String : addr1 String : addr2 String : city int : pin ii. Methods Write the respective set and get methods. c. Write a class RegCustomer which extends from the class Customer and has the instance variable double: fees. Write an appropriate parameterized constructor and call the base class constructor. d. Write a CustomerDemo class i. main method create an instance of the class RegCustomer by passing the required values and display the same. 7. Write a program to implement the below mentioned requirement a. GeneralInformation class i. Data UserId: int userName: String gender: boolean dateOfBirth: Date ii. Methods get and set methods parameterized constructor to accept values and initialize the data members

Pratian Technologies (India) Pvt. Ltd

Page 3

SkillAssure Learning Solutions

b. ContactInformation class i. Data contactId : int address: Address email: String phoneNo: String mobileNo: String residenceNo: String ii. Methods Get and set methods c. Address class i. Data address1: String address2: String city: String pin: int ii. Methods Get and set methods d. UserInformation class inherits from GeneralInformation class i. Data aboutMe: String relationshipStatus: String contact: ContactInformation ii. Methods Get and set methods Parameterized constructor to take all the necessary values (Contact information would not be sent to the constructor) e. UserDemo class i. Main() declare an object of UserInformation using constructor, pass values needed ii. storeContactInformation() pass UserInformation object and store contact iii. showUserInformation() pass UserInformation object and display all the information

Pratian Technologies (India) Pvt. Ltd

Page 4

SkillAssure Learning Solutions

8. Student report card a. Write a class Student i. Data members studentId: int studName: String gender: boolean subjects: Subject ii. Methods get and set methods for all the instance variables. b. Write a class Subject i. Data members subject1: String marks1: float subject2: String marks2: float subject3: String marks3: float ii. Methods Write the respective set and get methods. c. Write a class ResultGenerator i. Methods generateResult - static Takes the Student object and calculates the total and average and displays the report card d. Write a StudentDemo class i. main method create an instance of the class Student pass the Student object to storeStudentData method to fill it with values call the generateResult method to show the report card ii. storeStudentData Take the Student object and fill it with necessary data

Pratian Technologies (India) Pvt. Ltd

Page 5

SkillAssure Learning Solutions

9. Tax calculator a. Write a class Employee i. Data members empId: int empName: String empGender: char empSalary: Salary ii. Methods get and set methods for all the instance variables. b. Write a class Salary i. Data members basic: double specialAllowance: double bonus: double investment: double ii. Methods get and set methods for all the instance variables Note: Monthly values to be stored c. Write a class TaxCalculator ii. Methods calculateTax (static) Takes the employee object and displays the name, employee id, gender, gross annual salary, taxable income, net salary and tax payable d. Write a class EmployeeDemo iii. Methods Main a. create an instance of the class Employee b. fill employee object with values c. call the calculateTax method to display the necessary information

Pratian Technologies (India) Pvt. Ltd

Page 6

Potrebbero piacerti anche