NOTE: YOU HAVE TO CREATE CLASS WITHOUT STRING(LIKE Mark..etc)
PART-1 WE ARE USING GET COMMAND.
PART-2 WE USE SET COMMAND.
IN PART 2 OUTPUT DISPLAY NOT IN PART 1 .
import java.text.*;
import java.util.Scanner;
public class Subject {
private String name;
private double math;
private double physics;
private double chemistry;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getMath() {
return math;
}
public void setMath(double math) {
this.math = math;
}
public double getPhysics() {
return physics;
}
public void setPhysics(double physics) {
this.physics = physics;
}
public double getChemistry() {
return chemistry;
}
public void setCheminstry(double cheminstry) {
this.chemistry = cheminstry;
}
public void display() {
System.out.println("Mark List");
System.out.println("Name : " + getName());
System.out.println("Math : " + getMath());
System.out.println("Physics : " + getPhysics());
System.out.println("Chemistry : " + getChemistry());
}
}