Question: java code 1. Write a program in a Java source file called AverageMults.java that reads integer values from the user until the user has entered

 java code 1. Write a program in a Java source file

java code

1. Write a program in a Java source file called AverageMults.java that reads integer values from the user until the user has entered 15 values. The program should compute the average of the values entered by the user, but only those values that are multiples of either 4 or 7. All other values, including the non-positive value that ends user input should be ignored. Display the average or display the message "Average not computed; no multiples of 4 or 7 were entered." if no multiples of either 4 or 7 were entered by the user. For example, if the user enters 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, then the program would ignored all values except for 4, 7, 8, 12, and 14 and produce the average 9.00. If the user enters 2,3,5, 6, 8, 9, 10, 11, 13, 15, 17, 18, 19, 22, 23, then the program would display the message "Average not computed; no multiples of 4 or 7 were entered." 2. Write a program in a Java source file called SumMults.java that reads integer values from the user until the user enters the value 0. The program should compute the sum of the values entered by the user (except for the zero value that stops the input) as long as the values are between -100 and +100, inclusive. Display the sum and the number of values that were included in the sum. 3. Write a program in a Java source files called CountPrimes.java that reads an integer values from the user. The program then counts the number of prime integers that are less than or equal to the value that was read. A prime integer is greater than one and has no factors other than one and itself. Display the number of prime integers less than the value read

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!