Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

5 2 8 0 4 0 . 3 4 8 9 5 2 8 . 9 3 z q y 7 Jump to level 1

528040.3489528.93zqy7
Jump to level 1
Given the integer array yearlySalaries with the size of NUM_VALUES, assign numMatches with the number of integers in userValues that are equal to 1.
Ex: If the input is 45
Number of 1 s in array: 4
import java.util.Scanner;
public class ArrayComparison {
public static void main(String[] args){
Scanner scnr = new Scanner(
System.in);
final int NUM_VALUES =6;
int [] yearlySalaries = new int [NUM_VALUES];
int i;
int numMatches;
for yearlySalaries.length; ++i){
}
yearlysalaries [i]=scnr. nextInt () ;
Y* Your code goes here */
System.out.println("Number of 1s in array: "+ numMatches);
1
2
3
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

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

Understanding Oracle APEX 5 Application Development

Authors: Edward Sciore

2nd Edition

1484209893, 9781484209899