Question: I need help being able to call the method from ScientificNot to the Main class then displaying to output. Thanks. class Main { public static

I need help being able to call the method from ScientificNot to the Main class then displaying to output. Thanks.

class Main {

public static void main(String[] args) {

ScientificNot scinumber = new ScientificNot("31536000", 1);

System.out.println(scinumber);

}

}

class ScientificNot {

char decimal = '.';

String value;

int prec;

public ScientificNot() {

value = "";

prec = 0;

}

public ScientificNot(String value, int prec) {

this.value = value;

this.prec = prec;

}

public String getValue() {

return value;

}

public ScientificNot convertSci(String value, int prec) {

if (prec == 0) {

value = value.charAt(0) + value.substring(1, prec + 1) + "E"

+ value.substring(prec, value.substring(0).length()).length();

if (prec == 1) {

value = (value.charAt(0) + value.substring(1, 1) + decimal + value.substring(1, prec + 1) + "E"

+ value.substring(1, value.substring(0).length()).length());

if (value.length() < prec) {

prec = value.length();

value = (value.charAt(0) + value.substring(1, 1) + decimal + value.substring(1, prec + 1) + "E"

+ value.substring(1, value.substring(0).length()).length());

}

}

}

}

public String toString() {

return value + "," + prec;

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!