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
goblinko [34]
3 years ago
9

Complete the following method that takes a String parameter that is a time in American 12 hour format, such as "06:12 PM." The m

ethod returns a String with the same time in standard international 24 hour form. For example, given the parameter in the example above, the method would return "18:12." Values with AM correspond to times from 00:00 to 11:59 and PM for times from 12:00 to 23:59. Recall the method Integer.parseInt() takes a String parameter and returns the integer equivalent. And then simply I am supposed to create a method like so... public static String convertTime(String amerFormat) { }
Engineering
1 answer:
goldfiish [28.3K]3 years ago
8 0

Answer:

public class AmericanTimeFormatting {

  public static String convertTime(String amerFormat)

  {

   

      if(amerFormat.length()<8) {

          System.out.println("Length of the input string should be 8");

          return null;

      }

   

      else if(!Character.isDigit(amerFormat.charAt(0)) && !Character.isDigit(amerFormat.charAt(1)) && !Character.isDigit(amerFormat.charAt(3)) && Character.isDigit(amerFormat.charAt(4))) {

          System.out.println("Digit is requird");

          return null;

      }

 

      else if(amerFormat.charAt(2)!=':'|| amerFormat.charAt(7)!='.') {

          System.out.println("Punctuation required");

          return null;

      }

      //Am or Pm specification check

      else if(!amerFormat.substring(5,7).equals("PM") && !amerFormat.substring(5,7).equals("AM")){

          System.out.println("Required PM or AM");

          return null;

      }

      else {

          //For PM

          if(amerFormat.substring(5,7).equals("PM")) {

              String time="";

              int hour=Integer.parseInt(amerFormat.substring(0,2));

              hour=24-(12-hour);

              time+=String.valueOf(hour)+":";

              int minute=Integer.parseInt(amerFormat.substring(3,5));

              time+=minute;

              return time;

          }

          //For AM

          else {

              return amerFormat.substring(0,5);

          }

         

      }

  }

  public static void main(String[] args) {

 

      String time=convertTime("06:12PM.");

   

      if(!time.equals(null)) {

          System.out.println("Time is "+time);

      }

  }

}

You might be interested in
What are the basic parts of a radio system
Romashka-Z-Leto [24]
Today's radio consists of an antenna, printed circuit board, resistors, capacitors, coils and transformers, transistors, integrated circuits, and a speaker. All of these parts are housed in a plastic case. An internal antenna consists of small-diameter insulated copper wire wound around a ferrite core.
4 0
4 years ago
Consider tests of an unswept wing that spans the wind tunnel and whose airfoil section is NACA 23012. Since the wing model spans
Dominik [7]

Answer:

Check the explanation

Explanation:

to know the lift per unit span (N/m) that is expected to be measured when the wing attack angle is 4°

as well as the corresponding section lift coefficient and die moment coefficient .

Kindly check the attached image below to see the step by step explanation to the above question.

3 0
3 years ago
In contouring, it is necessary to measure position and not velocity for feedback.
EastWind [94]

Answer:

(1). False, (2). True, (3). False, (4). False, (5). True.

Explanation:

The term ''contouring'' in this question does not have to do with makeup but it has to deal with the measurement of all surfaces in planes. It is a measurement in which the rough and the contours are being measured. So, let us check each questions again.

(1). In contouring, it is necessary to measure position and not velocity for feedback.

ANSWER : b =>False. IT IS NECESSARY TO MEASURE BOTH FOR FEEDBACK.

(2). In contouring during 2-axis NC machining, the two axes are moved at the same speed to achieve the desired contour.

ANSWER: a=> True.

(3). Job shop is another term for process layout.

ANSWER: b => False

JOB SHOP IS A FLEXIBLE PROCESS THAT IS BEING USED during manufacturing process and are meant for job Production. PROCESS LAYOUT is used in increasing Efficiency.

(4). Airplanes are normally produced using group technology or cellular layout.

ANSWER: b => False.

(5). In manufacturing, value-creating time is greater than takt time.

ANSWER: a => True.

8 0
3 years ago
Calculate the volume of a hydraulic accumulator capable of delivering 5 liters of oil between 180 and 80 bar, using as a preload
Vinil7 [7]

Answer:

1) V_o = 10 liters

2) V_o = 12.26 liters

Explanation:

For isothermal process n =1

V_o =\frac{\Delta V}{(\frac{p_o}{p_1})^{1/n} -(\frac{p_o}{p_2})^{1/n}}

V_o  = \frac{5}{[\frac{72}{80}]^{1/1} -[\frac{72}{180}]^{1/1}}

V_o = 10 liters

calculate pressure ratio to determine correction factor

\frac{p_2}{p_1} =\frac{180}{80} = 2.25

correction factor for calculate dpressure ration  for isothermal process is

c1 = 1.03

actual \ volume = c1\times 10 = 10.3 liters

b) for adiabatic process

n =1.4

volume of hydraulic accumulator is given as

V_o =\frac{\Delta V}{[\frac{p_o}{p_1}]^{1/n} -[\frac{p_o}{p_2}]^{1/n}}

V_o  = \frac{5}{[\frac{72}{80}]^{1/1.4} -[\frac{72}{180}]^{1/1.4}}

V_o = 12.26 liters

calculate pressure ratio to determine correction factor

\frac{p_2}{p_1} =\frac{180}{80} = 2.25

correction factor for calculate dpressure ration  for isothermal process is

c1 = 1.15

actual \volume = c1\times 10 = 11.5 liters

8 0
3 years ago
For each topic, find the total number of blurts that were analyzed as being related to the topic. Order the result by topic id.
photoshop1234 [79]

Answer:

Explanation: see attachment below

8 0
3 years ago
Other questions:
  • 1. Copy the file Pay.java (see Code Listing 1.1) from the Student CD or as directed by your instructor. 2. Open the file in your
    10·1 answer
  • Block A has a weight of 8 lb. and block B has a weight of 6 lb. They rest on a surface for which the coefficient of kinetic fric
    8·1 answer
  • 10. The repair order is a legal document because
    7·1 answer
  • What is the definition of a tolerance on a dimension typically found on technical drawings?
    7·1 answer
  • You will create three classes, the first two being Student and LineAtOfficeHour. The instances of the first class defines a sing
    8·1 answer
  • A 220-V electric heater has two heating coils that can be switched such that either coil can be used independently or the two ca
    15·1 answer
  • What is the most likely reason the rover won't travel in a straight line?
    9·1 answer
  • Which option distinguishes why the behaviors of the team in the following scenario are so important during the engineering desig
    5·1 answer
  • 4.6. What is the maximum peak output voltage and current if the supply voltages are changed to +15 V and -15 V.​
    6·1 answer
  • Describe how you would control employee exposure to excessive noise in a mining environment
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!