Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

code must be in java and work with the following class. public class RangeInput{ private int currentValue; private int highValue; private int lowValue; public RangeInput

image text in transcribed

code must be in java and work with the following class.

public class RangeInput{

private int currentValue;

private int highValue;

private int lowValue;

public RangeInput (int low, int high) {

/ this is the constructor

// your code here

}

public void up () {

/ this is a mutator method / that increases currentvalue if allowed

// your code here

}

public void down () {

// this is a mutator method

// that decreases currentValue if allowed

/ your code here

public it getCurrentValue () {

//this is an accessor method

// your code here

This is the RangeInput test class

Your code for problem 3.3 must work with this

You should not change this class

/

public class RangeInputTester

public static void main (String[] args) {

RangeInput myInput = new RangeInput (40,50) ;

System.out.printin("current value: " + myInput. getCurrentValue ()) ;

for (int i=0;i

myInput.up () ;

}

System.out.println ("new value:

+ myInput. getCurrentValue ()) ;

for (int i=0;i

myInput. down () ;

}

System.out. println ("last value:

" + myInput. getCurrentValue ()) ;

3 Write a class RangeInput that allows users to enter a value within a range of values that is provided in the constructor. An example would be a temperature control switch in a car that allows inputs between 60 and 80 degrees Fahrenheit. The input control has "up" and "down" buttons. Provide up and down methods to change the current value. The initial value is the midpoint between the limits. As with the preceding exercises, use Math.min and Math.max to limit the value. Write a sample program that simulates clicks on controls for the passenger and driver seats

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

Professional IPhone And IPad Database Application Programming

Authors: Patrick Alessi

1st Edition

0470636173, 978-0470636176

More Books

Students also viewed these Databases questions