Question: java programing. please do all 3 * Testscores.java * Dean & Dean * This implements an algorithm that averages test scores. import java.uti1. Scanner: public

java programing. please do all 3
java programing. please do all 3 * Testscores.java * Dean \& Dean
* This implements an algorithm that averages test scores. import java.uti1. Scanner:

* Testscores.java * Dean \& Dean * This implements an algorithm that averages test scores. import java.uti1. Scanner: public class Testscores C public static void main(String[] args) [ Scanner stdIn - new Scanner(System. in): int score: int scoresum = 0 int count - 0 : double average - 0 : System,out. print("Enter score (-1 to quit): "): score - stdIn.hextInt(): while ( score >0) C scoresum += score: count+i; average - (double) scoresum / count: System.out, print("Enter score (1 to quit): ") : score - stdin.nextlnt( ) : 3 System, out, println("Average score is " + average): J Il end main J II end Testscores class In the above program, note how the following lines appear above the loop and Page 167 also at the bottom of the loop: System.out. print( "Enter score (-1 to quit): -): score - stdin.nextint () : Modify the program so it avoids having those lines appear twice but keeps the same functionality. For your modification, you are required to use a boolean variable named done in the while loop's condition. 10. [after 4.13] Consider the following code fragment. Without changing the loop type, modify the code to prevent output when the input equals the sentinel value of zero. Scanner stdin - new Scanner (System. in): int x : do c x stdin, nextint () : System,out.printin("negative "+(x)); while (x0) : 11. [after 4.15] Here's a brain teaser that uses Boolean logic: You're traveling on a road, and you come to a fork in the road. You know that one path leads to a pot of gold and the other path leads to a dragon. There are two elves at the fork, both of whom know the way to the pot of gold. You know that one elf always tells the truth and the other elf always lies, but you don't know which elf is which. What single question should you ask to figure out the proper path to the pot of gold

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!