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
pashok25 [27]
2 years ago
12

Write a Java program called Decision that includes a while loop to prompt the user to enter 5 marks using the

Computers and Technology
1 answer:
Alex73 [517]2 years ago
4 0

Answer:

Written in Java

import javax.swing.JOptionPane;

public class Decision{

public static void main(String[] args) {

    int i = 1;

    while(i<=5){

    String score = JOptionPane.showInputDialog("Input <score>");

    int mark = Integer.parseInt(firstNumber);

    if(mark >= 50 && mark <= 100) {

        JOptionPane.showMessageDialog(null, mark, " is a pass", JOptionPane.PLAIN_MESSAGE);

    }

    else{

        JOptionPane.showMessageDialog(null, mark, " is a fail", JOptionPane.PLAIN_MESSAGE);

    }

    i++;

    }

}

}

Explanation:

This initializes the a counter variable i to 1

    int i = 1;

The following iteration is repeated as long as i is less than or equal to 5

    while(i<=5){

This prompts user for input

    String score = JOptionPane.showInputDialog("Input <score>");

This converts user input to integer

    int mark = Integer.parseInt(firstNumber);

This checks if input is within 50 and 100 (inclusive)

    if(mark >= 50 && mark <= 100) {

This prints pass

        JOptionPane.showMessageDialog(null, mark, " is a pass", JOptionPane.PLAIN_MESSAGE);

    }

If otherwise

    else{

This prints fail

        JOptionPane.showMessageDialog(null, mark, " is a fail", JOptionPane.PLAIN_MESSAGE);

    }

This increments the counter variable by 1

    i++;

    }

You might be interested in
What does this image represent?
gayaneshka [121]
The answer is c. Inkjet printer
8 0
3 years ago
Read 2 more answers
Write any two rules for writing algorithm​
inessss [21]

Answer:

1) = input and output should be defines precisely

2) = it shouldn't include computer code

5 0
3 years ago
What is the maximum number of communication paths for a team of twenty people?
MAVERICK [17]
Each of the 20 people has 19 other people to communicate to. If you add that all up you get 20*19 paths, but then each path is counted twice (back and forth), so we divide this by 2. 20*19/2 = 190.

The general forumula is n(n-1)/2
6 0
3 years ago
When an object is selected, it is surrounded by ________, which allow you to change the size of the object.?
boyakko [2]
Matter. because matter surrounds us all and helps us move and change. 
6 0
3 years ago
Definition of Computer forensics?
zysi [14]

Answer:

Computer forensics is the application of investigation and analysis techniques to gather and preserve evidence from a particular computing device in a way that is suitable for presentation in a court of law. The goal of computer forensics is to perform a structured investigation and maintain a documented chain of evidence to find out exactly what happened on a computing device and who was responsible for it.

Explanation:

If this helped you, please consider brainly.

Thank you ,

Miss Hawaii

5 0
2 years ago
Read 2 more answers
Other questions:
  • What effects will the different types of lighting produce on mountains?
    15·1 answer
  • In a(n) __________ situation, a wireless device is configured to appear to be a legitimate access point, enabling the operator t
    14·1 answer
  • When was internet created in which year​
    13·2 answers
  • Of the sequences listed below, which shows the correct order of the steps in the incident management workflow: (1) authenticate
    14·1 answer
  • Why computer is known as data processing system?
    14·1 answer
  • Jabria are you smart
    14·2 answers
  • The inFS.open(str) function has a string parameter str that specifies the _____ of the file to open.
    10·1 answer
  • Select the correct answer.<br> What do you understand by "exposition"?
    10·2 answers
  • Describe the main roles of the communication layer, the network-wide state-management layer, and the network-control application
    15·1 answer
  • What is the meaning of url <br>​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!