Create a class name test it has 2 private float variables na

Create a class name \'test\'. it has 2 private float variables named high score and low score. there is a public function in the class names SethighandLow which sets the high and low score. There is a public function named display , which prints both scores. Please show how you would create an object of \"test:\", set the scores and call the display.

Solution

public class Test {

    private float highscore,lowscore;

public void sethighandlow(float h,float l) {
highscore = h;

lowscore=l;
    }

    public Display() {
System.out.println(\"highscore\", +highscore);

System.out.println(\"lowscore\", +lowscore);
    }
public void printDetails() {

System.out.println(\"set high and low: \" + Sethighandlow(a,b));

    System.out.println(\"diplay: \" + Display());
}
}

Create a class name \'test\'. it has 2 private float variables named high score and low score. there is a public function in the class names SethighandLow which

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site