Question

Write a java program that reads in the rated bursting pressure and the current pressure, and...

Write a java program that reads in the rated bursting pressure and the current pressure, and determines if the boiler is operating at a safe pressure. For example:

Enter the rated bursting pressure of the boiler (psi): 625

Enter the current pressure (psi): 137.8

The maximum safe pressure is 208.3 psi.

The current pressure is safe.

or

Enter the rated bursting pressure of the boiler (psi): 625

Enter the current pressure (psi): 250

The maximum safe pressure is 208.3 psi.

WARNING! The current pressure is not safe.

Hint: Use three variables: burst_psi current_psi, and max_safe_psi

0 0
Add a comment Improve this question Transcribed image text
Answer #1

/* Designing the program exactly as per the comments mentioned*/

import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
   public static void main(String[] args)
{
   Scanner s=new Scanner(System.in);
   double burst_psi,current_psi,max_safe_psi=208.3;
   System.out.print("Enter the rated bursting pressure of the boiler (psi):");
   burst_psi=s.nextDouble();
   System.out.print("Enter the current pressure (psi):");
   current_psi=s.nextDouble();
   System.out.println("The maximum safe pressure is 208.3 psi.");
   if(current_psi>max_safe_psi)
       System.out.println("WARNING! The current pressure is not safe.");
   else
       System.out.println("The current pressure is safe.");
}
}

Sample output:

Enter the rated bursting pressure of the boiler (psi):625
Enter the current pressure (psi):250
The maximum safe pressure is 208.3 psi.
WARNING! The current pressure is not safe.


Refer the below screen short for more details:

public static void main(String[] args), Scanner s=new Scanner(System.in); double burst_psi, current psi,max_safe psi=208.3; S

Add a comment
Know the answer?
Add Answer to:
Write a java program that reads in the rated bursting pressure and the current pressure, and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • We have a steam heating boiler whose bursting pressure is known, but we of course want...

    We have a steam heating boiler whose bursting pressure is known, but we of course want to use it only at pressures well below this limit. Our engineers recommend a safety factor of 2; that is, we should never exceed a pressure that is half of the rated bursting pressure. Write a java program that reads in the rated bursting pressure and the current pressure, and determines if the boiler is operating at a safe pressure. Write a java program...

  • Write a Java program that first reads a positive integer from the user - let's call...

    Write a Java program that first reads a positive integer from the user - let's call it howMany. Then the program reads howMany pairs of integers - let's call them n1 and n2. For each pair, the program determines if the first component in the pair is a multiple of the second component, in other words, if n1 is a multiple of n2. For example, if numberOfPair is 5, your program will read 5 pairs of integers, and for each...

  • Write a Java program that reads in a word from the user and outputs each character...

    Write a Java program that reads in a word from the user and outputs each character of the word on a separate line. For example, if the user enters the input "Joe", your program should output: J o e You need to use a for-loop.

  • JAVA. Write a program that reads in a series of positive integers and prints out the...

    JAVA. Write a program that reads in a series of positive integers and prints out the maximum value entered. The user will indicate they are finished entering numbers by entering zero or a negative integer.

  • A java program Write a program that prompts for and reads in a positive    integer...

    A java program Write a program that prompts for and reads in a positive    integer into a variable n. Your program should then sum    the first n ODD integers and display the sum. For    example, if 3 is entered for n, your program should display    the the sum 1 + 3 + 5. If 5 is entered, your program should    display the sum 1 + 3 + 5 + 7 + 9. What is the...

  • Write the following program in Java: You are to write a Java program that reads an...

    Write the following program in Java: You are to write a Java program that reads an input file containing a list of words and their synonyms. You will repeatedly ask the user if they want to look up the synonyms of a word, add a new synonym for a word, or quit. Here is a sample run of the program (note that the program is expecting the input file, thesaurus.txt to be in the working directory for the code.): Enter...

  • Write a Java program that reads a word and prints its bigrams substrings. A character bigram...

    Write a Java program that reads a word and prints its bigrams substrings. A character bigram is defined as a continuous sequence of two characters in a word. For example, if the user provides the input "rum", the program prints ru um Hint: 1. set two pointers, one always moves from the beginning of the string and the other moves from i+2, in which i is the current position of the first pointer. 2. print an error message if the...

  • Write a program in Java that reads the file and does two things: Write to an...

    Write a program in Java that reads the file and does two things: Write to an output file called dataSwitch.txt the same data from the input file, but switch the order of the data entries on each line. For example, if the first line of the input file is “90001 57110”, the first line of the output file would be “57110 90001”. Additionally, print to the screen the number of lines in the file with a label

  • IN JAVA. Write a program that reads a file (provided as attachment to this assignment) and...

    IN JAVA. Write a program that reads a file (provided as attachment to this assignment) and writes the file to a different file with line numbers inserted at the beginning of each line. For example if file input is: This is a test File output should be 1. This is a test ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ BELOW FROM NOTEPAD FILE. This file contains lines of text to determine if you can properly read and write from a file.

  • C++ Write a program that reads three positive integers (> 0) from the command line (one...

    C++ Write a program that reads three positive integers (> 0) from the command line (one at a time), then computes and prints the smallest entered number. Use if-else statements for three integer comparison. Example: Enter an integer: 5 Enter an integer: 23 Enter an integer: 7 The smallest number is: 5 Example 2: Enter an integer: 3 Enter an integer: 3 Enter an integer: 6 The smallest number is: 3 "The input must be positive number. The program should...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
Active Questions
ADVERTISEMENT