Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a new class named HowManyEvens. The goal of this program is to use a method to count how many even elements are held in

Create a new class named HowManyEvens. The goal of this program is to use a method to count how many even elements are held in a 1D array that the user enters. Complete the following: a. In the main class

Create a new array called numbers that will hold 5 integer values.

Create a Scanner named getEntry that will get the users information.

Write a for-loop that gets five integer values from the user and stores them into the array.

Write an enhanced for-loop that prints the array (formatted nicely) to the screen.

Output how many even #s are in the array (using the numberOfEvens method to do so).

b. In a method called numberOfEvens Take in an integer array as a parameter. Create an integer variable called count that will act as a counter (to count # of evens) Write a standard for-loop to count the number of even numbers in the array. Return count

Create a new class named MyCalculator. The goal of this program is to use methods to perform calculator functions. Complete the following:

a. Write 4 methods ...

A method called add which takes in 2 integers & returns the sum of the numbers.

A method called subtract which takes in 2 integers & returns their difference.

A method called multiply which takes in 2 integers & returns their product.

A method called divide which takes in 2 integers & returns the correct decimal quotient.

b. Write a main method that Asks the user for two numbers and uses a Scanner to obtain those numbers.

Displays a Menu that appears like the following 1. Add 2. Subtract 3. Multiply 4. Divide 5. Exit Enter your choice:

Contains a while-loop that repeats the menu until the user enters option 5.

Gets the users choice and performs the correct action (use correct method or exit loop).

Displays the correct math problem and answer for the user (even the division problems).

(**The Coding Language is JAVA**)

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

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions

Question

3. The group answers the questions.

Answered: 1 week ago

Question

1. How will you, as city manager, handle these requests?

Answered: 1 week ago