Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

im trying to print out the number of steps using the toString() method but im unsure how to fix this. 16 public class MeasurementGenerator {

image text in transcribedim trying to print out the number of steps using the toString() method but im unsure how to fix this.
image text in transcribed
16 public class MeasurementGenerator { 17 public static void Steps() { 4018 Steps al = new Steps (al.toString(); 19 20 21 System.out.println (a1.getValue()); 22 } 23 I 24 25 public static void main(String[] args) { 26 System.out.println("The number of steps taken is"); 27 Steps(); 28 } 29 30 } 31 00 Javadoc Declaration Consoles sterminated> MeasurementGenerator (Java Application] C:\jdk-15\bin\javaw.exe (22 Feb 2021,06:16:21 -06:16:23) The number of steps taken is Exception in thread "main" java.lang. Error: Unresolved compilation problem: The constructor Steps(String) is undefined 14 public class Steps t 15 16 // Instance variables 17 private int value; 18 19 1/ Constructor 20 public Steps(int value) { 21 this.value = value; 22 } 23 24 25 public int getValue() { return value; // get the value of the number of steps 27 1 28 public void setValue(int newValue) { 29 this.value = value; // set the value for the number of steps 30 } 31 -32 public String toString() { 33 return "Steps [value=" + value + ")"; //display the contents of this steps object 34 } 26 35 36 )

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

Advances In Databases And Information Systems 25th European Conference Adbis 2021 Tartu Estonia August 24 26 2021 Proceedings Lncs 12843

Authors: Ladjel Bellatreche ,Marlon Dumas ,Panagiotis Karras ,Raimundas Matulevicius

1st Edition

3030824713, 978-3030824716

More Books

Students also viewed these Databases questions