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]
3 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]3 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
A user is reporting to you that they are unable to run a script named script1 within their home directory. The user has ownershi
lianna [129]

The correct scripts are:

chmod 765 script1

chmod u+x script1

A cοmmand is an instructiοn givеn by a usеr tеlling a cοmputеr tο dο sοmеthing, such a run a singlе prοgram οr a grοup οf linkеd prοgrams. Cοmmands arе gеnеrally issuеd by typing thеm in at thе cοmmand linе (i.е., thе all-tеxt display mοdе) and thеn prеssing thе ЕNTЕR kеy, which passеs thеm tο thе shеll.

In Unix-likе οpеrating systеms, chmοd is thе cοmmand and systеm call which may changе thе accеss pеrmissiοns tο filе systеm οbjеcts. It may alsο altеr spеcial mοdе flags. Thе rеquеst is filtеrеd by thе umask. Thе namе is an abbrеviatiοn οf changе mοdе.

8 0
4 years ago
⚠️JAVA⚠️<br> how did the output come like this ?
Morgarella [4.7K]
The first %d is the result of num 1 /bum 2
7 0
3 years ago
What are midi signals
gregori [183]

Answer: is a unified standard used when recording the sounds of instruments

3 0
3 years ago
Read 2 more answers
When you call a ____________ method, it executes statements it contains and then returns a value back to the program statement t
Maksim231197 [3]

Answer:

The answer is a VOID method.

Explanation:

A void method is one that simply performs a task and then terminates.

4 0
4 years ago
Read 2 more answers
A T-1 system multiplexes ___ into each frame
zimovet [89]

Answer:

PCM encoded samples from 24 voice band channels

Explanation:

The Multiplexer from a lot of inputs generates one single output. And it is the select line that determines which of the input is going to influence output. And the select lines determine the increase in the quantity of data that can be sent through the network in a given amount of time. And this is termed as a data selector. Please note, this is application of multiplexer in data transmission.

And now coming to the T1 carrier system, it is a time division multiplexor, which multiplexes the PCM encoded samples coming from 24 band channels that require to be transmitted over an optical fiber or single metallic wire pair. And for this question, we need what is being multiplexed, and that is as mentioned in the Answer section.

4 0
3 years ago
Other questions:
  • Write a single c statement to read an integer from the keyboard and assign it variable "num"
    6·1 answer
  • The graphical user interface (GUI) was pioneered in the mid-1970s by researchers at:
    10·2 answers
  • System inputs and outputs are produced at the end of the: A. systems analysis phase of the SDLC. B. systems planning and selecti
    12·1 answer
  • A bank uses a computer program during the night to tell if the alarm should ring. Sensors in the bank set the following Boolean
    5·1 answer
  • Harmful programs used to disrupt computer operation, gather sensitive information, or gain unauthorized access to computer syste
    7·1 answer
  • What was the first message ever sent in morse code?
    13·1 answer
  • A flowchart illustrating the site structure of a website is called a
    12·1 answer
  • which of the following is a likely problem for a driver in an urban area? A. fame animals on the roads B.not finding a gas stati
    6·1 answer
  • Write fade in shorthand​
    11·1 answer
  • Two things every professional PowerPoint presentation should have
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!