subject

LAB: Parsing dates Complete main() to read dates from input, one date per line. Each date's format must be as follows: March 1, 1990. Any date not following that format is incorrect and should be ignored. Use the substring() method to parse the string and extract the date. The input ends with -1 on a line alone. Output each correct date as: 3/1/1990.
Ex: If the input is:
March 1, 1990
April 2 1995
7/15/20
December 13, 2003
-1
then the output is:
3/1/1990
12/13/2003
LAB ACTIVITY: LAB: Parsing dates
DateParser. java
1 import java. util. Scanner;
2
3 public class Dateparser {
4 public static int getmonthsInt(string monthstring) {
5 int monthInt;
6
7 // Java switch/case statement
8 switch (monthstring) {
9 case "January":
10 monthInt = 1;
11 break;
12 case "February": 13
13 monthInt = 2;
14 break;
15 case "March":
16 monthInt = 3;
17 break;
18 case "April":
19 monthInt = 4;
20 break;

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 14:30
The β€œrule of 72” is used to approximate the time required for prices to double due to inflation. if the inflation rate is r%, then the rule of 72 estimates that prices will double in 72/r years. for instance, at an inflation rate of 6%, prices double in about 72/6 or 12 years. write a program to test the accuracy of this rule. for each interest rate from 1% to 20%, the program should display the rounded value of 72/r and the actual number of years required for prices to double at an r% inflation rate. (assume prices increase at the end of each year.)
Answers: 1
question
Computers and Technology, 22.06.2019 17:00
Which of the following is not contained on the slide show toolbar? a. next button b. slide button c. close button d. pen tool
Answers: 1
question
Computers and Technology, 23.06.2019 03:50
Q-1 which of the following can exist as cloud-based it resources? a. physical serverb. virtual serverc. software programd. network device
Answers: 1
question
Computers and Technology, 23.06.2019 17:00
Companies that implement and apply an information system effectively can create
Answers: 1
You know the right answer?
LAB: Parsing dates Complete main() to read dates from input, one date per line. Each date's format...
Questions
question
Engineering, 29.08.2021 20:20
question
Mathematics, 29.08.2021 20:20
question
Mathematics, 29.08.2021 20:20
Questions on the website: 13722366