Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David J. Auer David M. Kroenke

13th Edition

B01366W6DS, 978-0133058352

More Books

Students also viewed these Databases questions

Question

LO2 Distinguish among three types of performance information.

Answered: 1 week ago