Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program 2 : Create a new Java project Loops 2 Create a class ( just like you did for Program 1 , Figure 1 New

Program 2:
Create a new Java project Loops 2
Create a class (just like you did for Program 1, Figure 1New Class)
a. name the class Loops 2
Enter the code as specified below
Run it by exercising all the menu options
Turn into the Dropbox as Loops 2.cpp
Program 2 Specification:
Name Main Menu
Minimum
Guess a Random number between 1 and 100?
Temperatures
Quit
Enter Choice (1,2,3,4) :
Create 3 functions for each option: (all functions called from main)
Option 1: LowerNumber
Write a function that asks user for 2 numbers and outputs the lower of the 2 numbers. This
function just needs a simple if else structure.
Option 2: GuessRandomNumber
Generate a random number from 1-100?
Ask the user to guess what the number is.
The user is allowed 10 guesses. Must use a for loop.
Give user a message if guess was too high or low
Give user a message if guess was right and how many tries it took
The top of the function should have:
Random randGen = new Random(); (don't forget to import java util.Random)
int randomNumber = randlaen nextInt (100)+1;
... your code here ...
Option 3: Temperatures
Write a function that
asks how many temperatures will be entered (following steps are in a loop)
asks for each temperature
outputs whether that temperature is hot/pleasant/cold (see below):
After this loop is complete (all temperatures have been entered)
outputs the maximum and minimum temperatures so far
outputs the average of temperatures entered so far
output the number of hot, pleasant and cold davs
Hot: temperature 85
Pleasant: temperature 60-84
Cold: temperature 60
Do not use arrays or lists
Use separate counters or sum variables as needed
image text in transcribed

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_2

Step: 3

blur-text-image_3

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

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

Students also viewed these Databases questions