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
Physical education is the body's ability to function effectively and efficiently without excessive farigue. TRUE/FALSE
Salsk061 [2.6K]

Answer: True

Explanation:

6 0
2 years ago
Who does Potholes effect in South Africa?
Morgarella [4.7K]
By definition, a pothole is a structure mostly located at the surface of roads and highways wherein it is usually characterised by having deep crevices which are primarily caused by extreme soil erosion or the presence of water in the area. In addition, these potholes greatly affect the transportation system of South Africa because the flow of traffic will be interrupted.
4 0
3 years ago
Your team at amazon is overseeing the design of a new high-efficiency data center at hq2. a power grid need to be generated for
elixir [45]

Answer:

void print2(int row) {

for (int i = 0; i < row; i++) {

 char ch = 'a';

 char print = ch;

 for (int j = 0; j <= i; j++) {

  cout << print++;

 }

 cout << endl;

}

}

int count_digits(int num) {

int count = 0;

int temp = num;

while (temp != 0) {

 temp = temp / 10;

 count++;

}

return (num % count);

}

Explanation:

3 0
2 years ago
Brian has created the following selection sort class in Java. In which line is the index of the smallest value returned? In whic
katen-ka-za [31]

Answer:

Explanation:

Since there are no line numbers in this question I will start counting from public class SelectionSort{ as line 1 and so on, as well as provide the code on that line.

The index of the smallest value is returned on line 8 where it says return min which shouldn't have any spaces and should be return minPosition;

The input array is given as an argument at the beginning of the function on line 2 where it says private static int positionMin (int] vals, int startPosition) {, as the variable vals.

This input array is also used as an argument on line 10 where it says Position; private static void swap(int] vals, int firstPosition, int secondPosition) and line 15 where it says vals[secondPosition] temp return public static void selSort(int| vals) {

8 0
3 years ago
A popular photo editing application provides customers with the option of accessing a web based version through a monthly subscr
Black_prince [1.1K]

Answer:

photoshop app that purchase with a lower price 3$ per month

6 0
2 years ago
Other questions:
  • An OR function nested in an IF function results in
    11·1 answer
  • The biggest factor in determining the price of a mortgage is:
    14·1 answer
  • A potential threat to administrators’ ability to manage the correctional system is
    12·1 answer
  • How do you activate the Formula AutoComplete function of Excel 2016?
    15·2 answers
  • What is key for evaluating internal controls such as human resources, logistics, information technology, risk, legal, marketing
    11·1 answer
  • True or False: <br> The object reference can be used to polymorphically store any class in Java.
    13·1 answer
  • Laura is filming a scene in which the subject is sitting with a lit fireplace behind him. The only other source of light in the
    15·1 answer
  • Which tab on the Ribbon contains the command to print a publication?
    10·1 answer
  • Write the line of Python code that calculates and prints the answer to the following arithmetic expressions.
    7·1 answer
  • Which open-sourced packet capture tool uses linux and mac os x operating systems?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!