Ravi Tutorials Provide Project Training

Java Assignment

PHP ASSIGNMENT 3 Java Assignment 2019

Programs Assignment 2

1. Write a Java program to show that private member of a super class cannot be accessed from derived classes.
2. Write a program which show the calling sequence of default constructor in multilevel inheritance.
3. Create a class Student and derive class Result. Student class has name and rollNo. Result class has sub1, sub2, sub3 and total_marks. Student class and Result class has their own display method to display their parameters. Display the result of 5 students. Take input using parameterized constructors. Use super keyword to call parent class constructor and parent class method.
4. Write a class Worker and derive classes DailyWorker and SalariedWorker from it. Every worker has a name and a salary rate. Write method ComPay (int hours) to compute the week pay of every worker. A Daily Worker is paid on the basis of the number of days s/he works. The Salaried Worker gets paid the wage for 40 hours a week no matter what the actual hours are. Test this program to calculate the pay of workers. You are expected to use the concept of polymorphism to write this program.