1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Klio2033 [76]
3 years ago
15

Implement a Java program using simple console input & output and logical control structures such that the program prompts th

e user to enter 5 integer scores between 0 to 100 as inputs and does the following tasks For each input score, the program determines whether the corresponding score maps to a pass or a fail. If the input score is greater than or equal to 60, then it should print "Pass", otherwise, it should print "Fail". After the 5 integer scores have been entered, the program counts the total number of passes as well as the total number of failures and prints those 2 count values with appropriate messages like "Total number of passes is: " & "Total number of failures is: ". After the 5 integer scores have been entered, the program finds the highest score as well as the lowest score and prints those 2 values with appropriate messages like "Highest score is: " & "Lowest score is: ". The program checks whether an input score is a number between 0 - 100 or not. If the input score value is otherwise or outside the above range, then it prints the error message saying "Invalid score" and prompts the user for valid input.
Computers and Technology
1 answer:
miss Akunina [59]3 years ago
5 0

Answer:

  1. import java.util.Scanner;
  2. public class Main {
  3.    public static void main(String[] args) {
  4.        int pass = 0;
  5.        int fail = 0;
  6.        int highest = 0;
  7.        int lowest = 100;
  8.        int counter = 0;
  9.        Scanner input = new Scanner(System.in);
  10.        while(counter < 5){
  11.            System.out.print("Input a score between 0 to 100: ");
  12.            int score = input.nextInt();
  13.            while(score < 0 || score > 100){
  14.                System.out.println("Invalid score.");
  15.                System.out.print("Input a score between 0 to 100: ");
  16.                score = input.nextInt();
  17.            }
  18.            if(score >= 60 ){
  19.                System.out.println("Pass");
  20.                pass++;
  21.            }else{
  22.                System.out.println("Fail");
  23.                fail++;
  24.            }
  25.            if(highest < score ){
  26.                highest = score;
  27.            }
  28.            if(lowest > score){
  29.                lowest = score;
  30.            }
  31.            counter++;
  32.        }
  33.        System.out.println("Total number of passes is: " + pass);
  34.        System.out.println("Total number of failures is: " + fail);
  35.        System.out.println("Highest score is: " + highest);
  36.        System.out.println("Lowest score is: " + lowest);
  37.    }
  38. }

Explanation:

Firstly, declare the necessary variables and initialize them with zero (Line 4-8). Next create a Scanner object to get user input for score (Line 10). Create a while loop by using the counter as limit (Line 12). In the while loop, prompt user to input a number between 1 - 100 (Line 13-14). Create another while loop to check the input must be between 1 - 100 or it will print invalid message and ask for user input again (Line 15-19).

Next, create an if-else statement to check if the current score is equal or above 60. If so print pass if not print fail (Line 21-27). At the same time increment the fail and pass counter.

Create another two if statement to get the current highest and lowest score and assign them to highest and lowest variables, respectively (Line 29-35).

Increment the counter by one before proceeding to the next loop to repeat the same process (Line 37).

At last, print the required output after finishing the while loop (Line 40-43).

You might be interested in
Which is better intel or amd real debate.
natima [27]

I believe Intel is better at handling games. Not saying AMD isn't good, just not as good. AMD is better for handling multiple task. I personally don't mind either.

8 0
3 years ago
Read 2 more answers
In order to paint a wall that has a number of windows, we want to know its area. Each window has a size of 2 ft by 3 ft. Write a
Eva8 [605]

Using the knowledge in computational language in JAVA it is possible to write a code that write a program that reads the width and height of the wall and the number of windows, using the following prompts

<h3>Writting the code:</h3>

<em>import java.util.Scanner;</em>

<em>public class WallArea {</em>

<em>    public static void main(String[] args) {</em>

<em>        Scanner sc = new Scanner(System.in);</em>

<em>        final int areaOfWindows = 6;</em>

<em>        System.out.print("Wall width: ");</em>

<em>        double width = sc.nextDouble();</em>

<em>        System.out.print("Wall height: ");</em>

<em>        double height = sc.nextDouble();</em>

<em>        System.out.print("Number of windows: ");</em>

<em>        double numberOfWindows = sc.nextDouble();</em>

<em>        double area = (width * height) - (numberOfWindows * areaOfWindows);</em>

<em>        System.out.println("Area: " + area);</em>

<em>    }</em>

<em>}</em>

See more about JAVA at brainly.com/question/12975450

#SPJ1

4 0
2 years ago
What wireless channel should I use?
pav-90 [236]
When looking at wireless channels, there are a couple of variables to keep in mind:
The number of other networks using what channels
The strength of the other networks on other channels

So generally speaking, channels 1, 6, and 11 are used by default. The reason for this is because there isn't any adjacent channel interference when you have all of your networks spread out in that manner. If for example, a network was using channel 3, that network would interfere with the signals one channel 1 and 6, and the bandwidth of those channels would have to be shared amongst all of those networks. This isn't optimal. Ideally you should look for a channel with less hosts who have weak signals. I know that in my area, channel 11 is the best channel to be on, because the hosts using that channel have weak signal strengths, which results in a lesser chance of those signals interfering with mine.
4 0
3 years ago
Read 2 more answers
What is the specifications, number of sales, positive and negative points and a few popular games of the first PlayStation?
Semmy [17]
Specs:
CPU
R3000A 32bit RISC chip @ 33.8mhz - Manufactured by LSI Logic Corp.
Clearing capacity: 30 MIPS
Bus bandwidth: 132 Mb/sec

3D Geometry Engine
High speed matrix calculator
Clearing capacity: 66 MIPS
1.5 million flat-shaded polygons/sec
500,000 texture-mapped and light-sourced polygons/sec

Data Engine (MDEC)
Clearing capacity: 80 MIPS
CPU, direct bus connection
Also compatible with JPEG, H.261 files

Sound
ADPCM, 24 channels
Sampling frequency: 44.1 Khz

Graphics
16.7 million colors
Resolution: 256x224 - 740x480
Sprite/BG drawing
Adjustable frame buffer
No line restriction
Unlimited CLUTs (Color Look-Up Tables)
4,000 8x8 pixel sprites with individual scaling and rotation
Simultaneous backgrounds (Parallax scrolling)
360,000 polygons/sec

Memory:
Main RAM: 2 Megabytes
VRAM: 1 Megabyte
Sound RAM: 512 K
CD-ROM buffer: 32K
Operating System ROM: 512K
RAM cards for data save: 128K EEprom

Cd-rom
Double speed
<span>XA compliant
</span>
Number of sales: 102.49 million

Pros: Great game selection. Fantastic 3D graphics for the time, elegant console design, memory cards convenient and meant never running out of space and could play saved games on another console. Comfortable controllers, games stored in standard CD cases.

Cons: Long load times. <span>Often overheated which would cause audio skipping, even longer load times, and sometimes system failure! </span><span>Memory cards don't hold much.</span>

Games: Ridge Racer, Battle Arena Toshinden, and ESPN Extreme Games. on release. Later Spyro the Dragon, Tekken, Wipeout, Crash Bandicoot, Tomb Raider, Metal Gear Solid, Gran Turismo, Resident Evil, Silent Hill, Soul Blade, and Twisted Metal.
5 0
3 years ago
20.
Kazeer [188]

Answer:

Megabyte

Explanation:

Megabytes come before Gigabytes like how Gigabytes come before Terrabytes

8 0
3 years ago
Other questions:
  • Assume you're using a 3 button mouse. to access shortcut menus, you would
    6·2 answers
  • Which operator is used for quotient division in java​
    6·1 answer
  • Running stop signs and lights is an blank that a driver may be operating their vehicle under the influence of drugs
    8·2 answers
  • Seven Features of computer aids design software
    6·1 answer
  • This document shows a student's education and career goals and a way to achieve those goals.
    8·1 answer
  • QUESTION 56 Use the Windows ________ to check on a nonresponsive program. Backup utility Error-checking System Restore Task Mana
    6·1 answer
  • What is a algorithm
    6·1 answer
  • The metric unit used for length
    5·1 answer
  • if we try to use tail-recursive rules to implement non-tail-recursive rules, it will normally result in rules that are
    8·1 answer
  • What is the minimum amount of hard drive space required for a 64-bit Windows 10 installation?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!