Question

Grade of Steel (10 Points) (JAVA) A certain grade of steel is graded according to the...

Grade of Steel (10 Points) (JAVA)
A certain grade of steel is graded according to the following conditions:
a) Hardness (integer) must be greater than 50
b) Carbon content (float) must be less than 0.7
c) Tensile strength (integer) must be greater than 5600
The grades are as follows:
• Grade is 10 if all three conditions are met
• Grade is 9 if conditions a) and b) are met
• Grade is 8 if conditions b) and c) are met
• Grade is 7 if conditions a) and c) are met
• Grade is 6 if only one condition is met
• Grade is 5 if none of the conditions are met
Write a program, which will require the user to give values of hardness,
carbon content and tensile strength of the steel under consideration and
output the grade of the steel.
Below are sample runs (the values highlighted in red are user inputs).
1. Length
2. Mass
3. Temperature
Welcome to Unit Converter! Please choose from the menu
(1-3): 1
1. Foot
2. Inch
Please choose a unit to convert from (1-2): 2
1. Foot
2. Inch
Please choose a unit to convert to (1-2): 1
Please enter the value: 100
100 Inch = 8.333333333333334 Foot
Enter hardness: 60
Enter carbon content: 0.2
Enter tensile strength: 6000
Grade of steel is 10
Enter hardness: 40
Enter carbon content: 1.2
Enter tensile strength: 5000
Grade of steel is 5
Enter hardness: 75
Enter carbon content: 1.5
Enter tensile strength: 4000
Grade of steel is 6

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

Program:-

package demo;

import java.util.Scanner;

public class DemoTranslation {
   public static void main(String[] args) {
       {
           int n;
           int[] a = new int[100], c = new int[100];
           float[] b = new float[100];
           n = STDIN_SCANNER.nextInt();
           for(int i = 0; i < n; i++) {
               a[i] = STDIN_SCANNER.nextInt();
               b[i] = STDIN_SCANNER.nextFloat();
               c[i] = STDIN_SCANNER.nextInt();
           }
           for(int i = 0; i < n; i++) {
               if(a[i] > 50 && b[i] < 0.7 && c[i] > 5_600) {
                   System.out.println("10");
               } else if(a[i] > 50 && b[i] < 0.7 && c[i] < 5_600) {
                   System.out.println("9");
               } else if(a[i] < 50 && b[i] < 0.7 && c[i] > 5_600) {
                   System.out.println("8");
               } else if(a[i] > 50 && b[i] > 0.7 && c[i] > 5_600) {
                   System.out.println("7");
               } else if(a[i] > 50 || b[i] < 0.7 || c[i] > 5_600) {
                   System.out.println("6");
               } else if(a[i] < 50 && b[i] > 0.7 && c[i] < 5_600) {
                   System.out.println("5");
               }
           }
           return;
       }
   }

   public final static Scanner STDIN_SCANNER = new Scanner(System.in);
}

Add a comment
Answer #2
do u have answer for it using c programming code?
Add a comment
Know the answer?
Add Answer to:
Grade of Steel (10 Points) (JAVA) A certain grade of steel is graded according to the...
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
  • 6. a) All steel manufactured by Steelco must meet the following requirements: 3.2-3.5 % carbon; 1.8-2.5%...

    6. a) All steel manufactured by Steelco must meet the following requirements: 3.2-3.5 % carbon; 1.8-2.5% silicon; and 0.9-1.2 % nickel; and tensile strength of at least 45,000 per square inch (psi). Steelco manufactures steel by combining two alloys. The cost and properties of each alloy are given in the following Table. Alloy 1 $190 Alloy 2 $200 Cost per ton Percent silicon Percent nickel Percent carbon Tensile strength (psi) 2 2.5 1.5 3 4 50,000 42,000 Assume that the...

  • . a) All steel manufactured by Steelco must meet the following requirements: 3.2-3.5 % carbon; 1.8-2.5%...

    . a) All steel manufactured by Steelco must meet the following requirements: 3.2-3.5 % carbon; 1.8-2.5% silicon; and 0.9-1.2 % nickel; and tensile strength of at least 45,000 per square inch (psi). Steelco manufactures steel by combining two alloys. The cost and properties of each alloy are given in the following Table. Alloy 1 $190 Alloy 2 $200 2.5 Cost per ton Percent silicon Percent nickel Percent carbon Tensile strength (psi) 2 1.5 1 3 50,000 42,000 Assume that the...

  • a) All steel manufactured by Steelco must meet the following requirements: 3.2-3.5% carbon ; 1.8-2.5 %...

    a) All steel manufactured by Steelco must meet the following requirements: 3.2-3.5% carbon ; 1.8-2.5 % silicon; and 0.9-1.2 % nickel; and tensile strength of at least 45,000 per square inch (psi). Steelco manufactures steel by combining two alloys.. The cost and properties of each alloy are given in the following Table. Alloy 2 $200 2.5 Alloy 1 $190 Cost per ton Percent silicon Percent nickel Percent carbon Tensile strength (psi) 2 1.5 1 42,000 50,000 Assume that the tensile...

  • Bonus Problem (worth 5 extra points.) You must show all your work to receive credit! 26. You are asked to improve t...

    Bonus Problem (worth 5 extra points.) You must show all your work to receive credit! 26. You are asked to improve the hardness (and strength) of a steel sample by "carburization" process. The initial carbon content (co) of the sample is 0.2 wt %. You are using a carbon rich environment (hydro- carbon gas) to set the surface-carbon content (c) at 1.0 wt %. Using the Figure 5.11, calculate the required carburization temperature to reach a carbon content of 0.4...

  • 12. [25 points] A grade-2 through-hardened steel pinion with BHN of 350 is driving a steel...

    12. [25 points] A grade-2 through-hardened steel pinion with BHN of 350 is driving a steel gear of the same material and hardness. The diameteral pitch is 10, the number of teeth on pinion is 18, the face width is 0.95 inch, and the pressure angle of the full-depth teeth is 20 degrees The input (pinion) rpm is 2000 and the output rpm is 500. The gears transmit 5 horsepower. The gearbox precision corresponds to "commercial enclosed gear units". Determine...

  • Java programming only Create a Java program that inputs a grade from the user. The grade input from the user will be an...

    Java programming only Create a Java program that inputs a grade from the user. The grade input from the user will be an integer. Once the input is stored, use an if-else-if block of code to determine the letter grade of the inputted integer grade. Do not use a bunch of if statements by themselves to solve this problem. You will print an error message for inputs greater than 100 and for inputs less than 0. Both errors must be...

  • p1 p2 in p2 there is a typo, if grade <0 or grade >100: should be...

    p1 p2 in p2 there is a typo, if grade <0 or grade >100: should be if percent <0 or percent > 100: Write a program to compute a person's height & print out a message. The user will input feet and inches. The program will convert that to inches, and then print a message, based on the total inches. If the total inches is greater than 72, the message should be something like, "You're tall." If the total inches...

  • QUESTION 1 1 points The addition of some metallic elements to steels affect the properties of...

    QUESTION 1 1 points The addition of some metallic elements to steels affect the properties of the metal. The ability to alter the steel grain structure can be effected by the elements: Aluminum, Vanadium Chromium, Copper, Molybdenum, Tungsten Cobalt, Nickel Lead, Tellurium QUESTION 2 1 points An alloying element is any element added during the manufacture of steel that is not one of four (4) non-metals. An example of an alloying element IS. Tellurium Carbon O Silicon Sulfur QUESTION 3...

  • please solve the Program USING MATLAB. do not do #2. write in details for the command...

    please solve the Program USING MATLAB. do not do #2. write in details for the command lines. Make sure the program runs and also completely does what it askes please Write a Matlab program that displays on the screen checkerboard patterns comprising of two alternating_colors to be selected by the user. Your program MUST use as the checkerboard unit pattern a SQUARE INSCRIBED INSIDE A CIRCLE with unit pattern width and checkerboard dimension also to be inputted by the user....

  • Labview question: Create a VI using a While Loop that continuously generates random numbers between 0...

    Labview question: Create a VI using a While Loop that continuously generates random numbers between 0 and 1000 until it generates a number that matches a number selected by the user. Determine how many random numbers the VI generated before the matching number. conditions to applied on above problem: 1. Convert the “random number” generator floating point numerical output to integer values to make it easier to find a match. 2. The “user selected number control” should be on the...

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
ADVERTISEMENT