Assignment Classes and Object

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Assignment Classes and Object

1. Write a program that will create a Class ‘Car’ and its fields like CarModel, CarName,
CarPrice and CarOwner. The program should include functions to assign values to the
above-mentioned fields and a display function to show the values

2. Print the average of three numbers by creating a class named 'Average' having a
method to calculate and print the average

3. Print the sum, difference and product of two complex numbers by creating a class
named 'Complex' with separate methods for each operation and numbers will be
passed while function calling through object
4. Write a program by creating an 'Employee' class having the following methods and
print the final salary of employee. 1 - 'getInfo()' this method will take (a) name of the
employee (b) hourly rate and (c) total working hours in a month as parameter and will
do assignment ‘printSalary()’ this method will print the emoloyee’s monthly salary
along with employee name

You might also like