• Home
  • Blog
  • New England College Programming Java Program Problems & Solutions

New England College Programming Java Program Problems & Solutions

0 comments

1) Create a class which will prompt users
for input. The class should include a constructor with a String
parameter specifying the text of the prompt, a method for changing the
prompt, and a method for displaying the prompt and collecting the
response from the user, which returns the value entered by the user. You
may use the following code for this class or implement it any other way
you wish:

2) Code for assignment 5

Create a subclass of the previous class
which will prompt the user to input an integer value and test the
response to see if it’s a valid integer. The method to get a response
should print out an error message if the user enters a non-integer value
and continues asking the user to input a valid value (using the
prompt). Once a valid integer value is entered, it should return an
integer value. Create another subclass of the first class, which will
prompt the user to input a real/decimal number.

Then, write a simple Java program which
will declare and initialize at least three (3) variables appropriately
sized, typed, named, and commented. The first variable will be used to
hold the user’s current body temperature. The user’s body temperature
cannot exceed 116.0 and cannot be measured with any more precision than
the nearest tenth (10th) of a degree. The second variable will be used
to hold the user’s age in whole years and cannot be any value greater
than 120. You will then multiply the user’s age times his/her body
temperature to calculate his/her Akendian body temperature index, which
will be stored in a third variable.

Given the scenario provided for you,
write a Java program. Make sure that your Java program is appropriately
commented, including the name of the author of the code, when it was
created, and the date it was last modified. You must also use
stylistically correct names for your Java file, Java classes, variables,
and methods (if appropriate).

(code has to be able to run on command prompt. show pictures of results as well)

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}