New England College Programming Java Program Problems & Solutions
1) Create a class which will prompt usersfor input. The class should include a constructor with a Stringparameter specifying the text of the prompt, a method for changing theprompt, and a method for displaying the prompt and collecting theresponse from the user, which returns the value entered by the user. Youmay use the following code for this class or implement it any other wayyou wish:
2)
Create a subclass of the previous classwhich will prompt the user to input an integer value and test theresponse to see if it’s a valid integer. The method to get a responseshould print out an error message if the user enters a non-integer valueand continues asking the user to input a valid value (using theprompt). Once a valid integer value is entered, it should return aninteger value. Create another subclass of the first class, which willprompt the user to input a real/decimal number.Then, write a simple Java program whichwill declare and initialize at least three (3) variables appropriatelysized, typed, named, and commented. The first variable will be used tohold the user’s current body temperature. The user’s body temperaturecannot exceed 116.0 and cannot be measured with any more precision thanthe nearest tenth (10th) of a degree. The second variable will be usedto hold the user’s age in whole years and cannot be any value greaterthan 120. You will then multiply the user’s age times his/her bodytemperature to calculate his/her Akendian body temperature index, whichwill be stored in a third variable.Given the scenario provided for you,write a Java program. Make sure that your Java program is appropriatelycommented, including the name of the author of the code, when it wascreated, and the date it was last modified. You must also usestylistically 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)
Х
c. Administrator: Command Prompt
Microsoft Windows [Version 10.0.19842.1110]
(c) Microsoft Corporation. All rights reserved.
C:\WINDOWS\system32>cd C:\Program Files\Java\jdk-16.0.1\bin
C:\Program Files\Javaljdk-16.0.1\bin>java Test.java
Test.java:19: error: cannot find symbol
Decimalvalue decimal = new DecimalValue(“Enter your current body temperature: “);
symbol: class DecimalValue
location: class Test
Test.java:19: error: cannot find symbol
DecimalValue decimal = new DecimalValue(“Enter your current body temperature: “);
symbol: class DecimalValue
location: class Test
Test.java:20: error: cannot find symbol
Integervalue integer = new IntegerValue(“Enter your age: “);
symbol: class IntegerValue
location: class Test
Test.java:20: error: cannot find symbol
IntegerValue integer = new IntegerValue(“Enter your age: “);
symbol: class IntegerValue
location: class Test
4 errors
error: compilation failed
C:\Program Files\Java\jdk-16.0.1\bin>
Top-quality papers guaranteed
100% original papers
We sell only unique pieces of writing completed according to your demands.
Confidential service
We use security encryption to keep your personal data protected.
Money-back guarantee
We can give your money back if something goes wrong with your order.
Enjoy the free features we offer to everyone
-
Title page
Get a free title page formatted according to the specifics of your particular style.
-
Custom formatting
Request us to use APA, MLA, Harvard, Chicago, or any other style for your essay.
-
Bibliography page
Don’t pay extra for a list of references that perfectly fits your academic needs.
-
24/7 support assistance
Ask us a question anytime you need to—we don’t charge extra for supporting you!
Calculate how much your essay costs
What we are popular for
- English 101
- History
- Business Studies
- Management
- Literature
- Composition
- Psychology
- Philosophy
- Marketing
- Economics