RUVIDEO
Поделитесь видео 🙏

1-2 Java term Question solve 2021 session: 2020-2021

Here is the description video for the 3 questions.
Q-1:
Make a class Employee with a name and salary. Make a class Manager inherits from Employee. Add an instance variable, named department, of type String. Supply a method toString that prints the manager's name, department, and salary. Make a class Executive inherits from Manager. Supply appropriate toString methods for all classes. Supply a test program that tests these classes and methods.

Solve:
class Employee {
private String name;
private double salary;

public Employee(String name, double salary) {
this.name = name;
this.salary = salary;
}

public String toString() {
return "Name: " + name + ", Salary: " + salary;
}
}

class Manager extends Employee {
private String department;

public Manager(String name, double salary, String department) {
super(name, salary);
this.department = department;
}

public String toString() {
return super.toString() + ", Department: " + department;
}
}

class Executive extends Manager {

public Executive(String name, double salary, String department) {
super(name, salary, department);
}

public String toString() {
return "Executive: " + super.toString();
}
}

public class Q1 {
public static void main(String[] args) {
Employee emp = new Employee("Meena", 10000);
System.out.println(emp.toString());

Manager mng = new Manager("Raju", 20000, "Sales");
System.out.println(mng.toString());

Executive exec = new Executive("Mithu", 30000, "Marketing");
System.out.println(exec.toString());
}
}

Q-2:
Write a program MatrixSum (MatrixSum.java) that reads two input files which contain two matrices of size 3x4. Then write the sum of these two matrices into another file. For example, if you call

java MatrixSum A.txt B.txt C.txt

Then the program will read two input matrices from A. txt, B.txt and write the sum of these two input matrices into C.txt

#Solution:

Q-3:
Write a java class Example_throw, in which we have a method testMethod with an integer parameter. Declare two exceptions Exp1 and Exp2 using the throws keyword which will be activated depending on the value of the integer parameter. Then in the main function within ExceptionHandle class, the exceptions thrown are handled by the catch block.

Don't know why yt is not allowing to write the solutions of q-2,3 in the description.
Go through the video for the solutions

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «1-2 Java term Question solve 2021 session: 2020-2021», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.