Provide a java class named "input"

Assignment Help Computer Engineering
Reference no: EM1329517

Provide a Java class named "Input" containing the method "readInt" (prototype given below) that displays the prompt string, reads an integer, and tests whether it is between the supplied minimum and maximum. If not, it prints an error message and repeats the entire process.

public static int readInt(Scanner in, String prompt, String error, int min, int max)

Use the following class as the main class for testing the implementation.

import java.util.Scanner;

/**
This program prints how old you'll be next year.
*/
public class AgePrinter
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
int age = Input.readInt(in, "Please enter your age",
"Illegal Input--try again", 1, 150);
System.out.println("Next year, you'll be " + (age + 1));
}
}

Reference no: EM1329517

Questions Cloud

Explain how is the aggregate supply curve : Explain how is the aggregate supply curve different from the supply curve for a single good like pizza.
Computing present value of different annuities : Find the present value of $300,000 annuity at 6% for 20 years-Find the present value of $500,000 deferred annuity at 6% for 20 (21-40) years-Find the present value of 50,000 annuity at 6% for 40 years
Presidents enforcement powers and supremacy clause : When a state law and a federal law directly conflict, application of the Supremacy clause will normally result in which law controlling?
The hypothesis predicting : The hypothesis predicting that differences exist between the groups being compared is to the hypothesis predicting that no differences exist between the groups
Provide a java class named "input" : Provide a Java class named "Input" containing the method "readInt" (prototype given below) that displays the prompt string, reads an integer, and tests either it is between the supplied minimum and maximum. If not, it prints an error message and r..
Estimate the relationship among inflation-unemployment : Estimate the relationship among inflation,unemployment and business cycle on the industry.
Directional hypothesis is to non-directional hypothesis : Directional hypothesis is to non-directional hypothesis
Assorted problems in finance : The stocks of Microsoft and Apple have a correlation coefficient of 0.6. The variance of Microsoft stock is 0.4 and the variance of Apple stock is 0.3. What is the covariance between the two stocks?
Characteristics are important for fit leaders : What practices and characteristics are important for fit leaders? Which key practices are you committing to pursue in your life?

Reviews

Write a Review

Computer Engineering Questions & Answers

  An approximation to a zero of a continuous function

provide a pseudocode for the bisection method algorithm Bise(f(x),a,b,error) for finding an approximation to a zero of a continuous function f(x) in the interval [a, b] accurate to within error.

  Boolean functions

Simplify the following Boolean functions, using 3-variable maps: F (x,y,z) = Σ(0,2,6,7)

  Program to determine weighted average of test

Write an algorithm for a program which prompts the user to enter the five test scores, determine total of the five tests and determine the weighted average of each test supposing that each test weighs 20%.

  What required to happen in order for the database

If the computers of organization are to old, the database management system might not be installed in the organization and will not run properly or sometimes not at all. This information is good to remember as planning a particular database implem..

  What are the kinds of information systems

What are the kinds of information systems

  Digital technique for transmission of voice-telephone system

State four benefits and one de-merits of utilizing the digital (rather than analog) techniques for transmission of the voice-telephone signals.

  Make an employee class with enough numbers of data members

Make an Employee class with enough numbers of data members

  Briefly describe the concept of queues

Briefly describe the concept of queues.

  Describe two companies with a global presence

I want to construct a PowerPoint Presentation identifying, comparing, and contrasting the IT governance structure for two major companies with a global presence.

  Determine one protocol which works at the osi layer 2

suppose you are Dave Baker, the Senior System Administrator from Minnesota Consulting Group (MCG). The company with which MCG has an ongoing contract wishes to have some basic TCP/IP concepts explained to senior decision-makers.

  Developing the audio technologies

A company noting down the success of 24-bit digital audio technologies as compared to earlier 16-bit digital audio technologies has decided to work on developing the 28-bit digital audio technology.

  Excel supports nesting of functions

Excel supports nesting of functions within one another. Why is that helpful ? Offer some examples of when you would and would not want to use nesting.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd