Name: Alka Registration Number: 17bce2287 Set A: Ques1
Name: Alka Registration Number: 17bce2287 Set A: Ques1
SET A
QUES1
Assume you have a class ‘Employee’ with all basic information (e_id, name, sal)
and a method to display its details. Using this class create new classes like
‘Manager’, ‘Team Lead’, ‘Developer’, and ‘Trainee’ with their own specific
information (necessarily, eval_pts). For the yearly appraisal they should earn 10
evaluation points in the last financial year. Add 15% of their salary to their current
salary as an increment if they are eligible. Redefine the display method in the new
classes to display updated details. Write a Java program to test at least one object
in each (four) category of employees.
CODE
import java.util.*;
int id;
String name;
{
this.id=id;
this.sal=sal;
this.name=name;
this.eval_pts=eval_pts;
System.out.println("Name = "+name);
System.out.println("Salary = "+sal);
System.out.println("Id = "+id);
if(eval_pts>=10)
{
sal=0.15*sal + sal;
if(eval_pts>=10)
sal=0.15*sal + sal;
{
if(eval_pts>=10)
sal=0.15*sal + sal;
if(eval_pts>=10)
sal=0.15*sal + sal;
{
System.out.println("Manager\n");
obj1.get(101,1000,"RAJA",10);
obj2.evaluate();
obj1.display();
System.out.print("\n");
System.out.println("TechLead\n");
obj3.get(102,2000,"RITA",8);
obj4.evaluate();
obj3.display();
System.out.print("\n");
System.out.println("Developer\n");
obj5.get(103,3000,"RIYA",15);
obj5.display();
System.out.print("\n");
System.out.println("Trainee\n");
obj7.get(104,4000,"Raju",6);
obj8.evaluate();
obj7.display();
}
QUES2
Design a menu driven GUI application using JavaFX classes to compute the area of
different polygons such as
Square
Rectangle
Triangle
Circle
CODE
MAIN.JAVA
package application;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
//import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
@Override
try {
Parent root =
FXMLLoader.load(getClass().getClassLoader().getResource("application/Main.fxml
"));
scene.getStylesheets().add(getClass().getResource("application.css").toExte
rnalForm());
primaryStage.setScene(scene);
primaryStage.show();
} catch(Exception e) {
e.printStackTrace();
launch(args);
MAINCONTROLLER.JAVA
package application;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
@FXML
private TextField sq_len;
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
@FXML
private Button circleButton;
float r = sqLen*sqLen;
System.out.print(r);
result.setText(String.valueOf(r));
float r = rectLen*rectb;
System.out.print(r);
result.setText(String.valueOf(r));
System.out.print(r);
result.setText(String.valueOf(r));
float r = circle_l*circle_l*((float)3.14);
System.out.print(r);
result.setText(String.valueOf(r));
MAIN.FXML
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<children>
<font>
</font>
</Label>
<children>
<font>
</font>
<HBox.margin>
<Insets left="10.0" />
</HBox.margin>
</Text>
<HBox.margin>
</HBox.margin>
</Button>
</children>
</HBox>
<children>
<font>
</font>
<HBox.margin>
</Text>
<HBox.margin>
</HBox.margin>
</TextField>
<HBox.margin>
</HBox.margin>
</Button>
</children>
</HBox>
<children>
<font>
<Font size="18.0" />
</font>
<HBox.margin>
</HBox.margin>
</Text>
<HBox.margin>
</HBox.margin>
</TextField>
<HBox.margin>
</HBox.margin>
</Button>
</children>
</HBox>
<font>
</font>
<HBox.margin>
</HBox.margin>
</Text>
<HBox.margin>
</HBox.margin>
</Button>
</children>
</HBox>
<font>
<Font size="18.0" />
</font>
</Text>
<font>
</font>
</Label>
</children>
</AnchorPane>
OUTPUT