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
mr Goodwill [35]
2 years ago
10

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 substr() function 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 9.10.1: LAB: Parsing dates 0/10 main.cpp Load default template - COLE > 5 6 int DateParser(string month) 7 int monthInt = 0; if (month January) 10 monthint - 11 11 else if (month -- "February") 12 monthint - 21 13 else if (month - "March) montrent - 3; 15 else if (month -- "April") 16 monthInt - 4 else if (month "ay") monthint - 5 19 else if (month June") antin 6 21 else if (monthuly) 22 monthint - 7 else if (monthst") monthiet 8 LAB ACTIVITY 9.10.1: LAB: Parsing dates main.cpp 22 monthint - 1 23 else if (month == "August") 24 monthInt = 8; 25 else if (month - "September") 26 monthInt = 9; 27 else if (month -- "October") 28 monthInt - 10; 29 else if (month - "November") 30 monthInt - 11; 31 else if (month - "December") 32 monthInt = 12; 33 return monthint; 34 ) I 35 36 int main() { 37 38 // TODO: Read dates from input, parse the dates to find the one 39 1 in the correct format, and output in m/d/yyyy format 40 41) 42
Computers and Technology
1 answer:
Vladimir [108]2 years ago
6 0

The python code which can be used to read dates from input, one date per line and each date's format must be as follows: March 1, 1990, is:

<h3>Python code</h3>

import datetime

inputs = []

result = []

#read the inputs

date = input()

inputs.append(date)

while not date == "-1":

 date = input()

 inputs.append(date)

#check if the input is in the correct format and convert it.

for date_text in inputs:

 try:

   date_text = datetime.datetime.strptime(date_text,"%d %B, %Y")

   result.append(date_text.strftime("%d/%m/%Y"))

 except ValueError:

   pass

   

print(*result, sep = "\n")

The above code would parse the string and extract the date. The split() method was used to break the input into tokens.

Read more about python programming here:

brainly.com/question/27666303

#SPJ1

You might be interested in
Can you repeat 10th grade if you need too and want too.
blondinia [14]

Im pretty sure you can but different schools have different rules so try contacting your guidence counselor and asking them

7 0
3 years ago
Read 2 more answers
As a student, why do you need to know and follow the steps printing a <br><br>document?​
Kazeer [188]
So I am able to print my math notes and keep up in geometry.
7 0
2 years ago
Read 2 more answers
Write, compile, and test the MovieQuoteInfo class so that it displays your favorite movie quote, the movie it comes from, the ch
Irina18 [472]

Using the knowledge of computational language in JAVA it is possible to write a code that removes your favorite phrase from the movie. It consists of two classes in which one is driver code to test the MovieQuoteInfo class.

<h3>Writing code in JAVA:</h3>

<em>public class MovieQuoteInfo { //definition of MovieQuoteInfo class </em>

<em> //All the instance variables marked as private </em>

<em> private String quote;</em>

<em> private String saidBy;</em>

<em> private String movieName;</em>

<em> private int year;</em>

<em> public MovieQuoteInfo(String quote, String saidBy, String movieName, int year) { //parameterized constructor </em>

<em>  super();</em>

<em>  this.quote = quote;</em>

<em>  this.saidBy = saidBy;</em>

<em>  this.movieName = movieName;</em>

<em>  this.year = year;</em>

<em> }</em>

<em> //getters and setters </em>

<em> public String getQuote() {</em>

<em>  return quote;</em>

<em> }</em>

<em> public void setQuote(String quote) {</em>

<em>  this.quote = quote;</em>

<em> }</em>

<em> public String getSaidBy() {</em>

<em>  return saidBy;</em>

<em> }</em>

<em> public void setSaidBy(String saidBy) {</em>

<em>  this.saidBy = saidBy;</em>

<em> }</em>

<em> public String getMovieName() {</em>

<em>  return movieName;</em>

<em> }</em>

<em> public void setMovieName(String movieName) {</em>

<em>  this.movieName = movieName;</em>

<em> }</em>

<em> public int getYear() {</em>

<em>  return year;</em>

<em> }</em>

<em> public void setYear(int year) {</em>

<em>  this.year = year;</em>

<em> }</em>

<em> //overriden toString() to print the formatted data</em>

<em> public String toString() {</em>

<em>  String s = quote+",\n";</em>

<em>  s+="said by "+this.saidBy+"\n";</em>

<em>  s+="in the movie "+this.movieName+"\n";</em>

<em>  s+="in "+this.year+".";</em>

<em>  return s;</em>

<em> }</em>

<em>}</em>

<em>Driver.java</em>

<em>public class Driver { //driver code to test the MovieQuoteInfo class</em>

<em> public static void main(String[] args) {</em>

<em>  MovieQuoteInfo quote1 = new MovieQuoteInfo("Rosebud", "Charles Foster Kane", "Citizen Kane", 1941);//Create an object of MovieQuoteInfo class</em>

<em>  System.out.println(quote1); //print its details </em>

<em> }</em>

<em>}</em>

See more about JAVA at brainly.com/question/12975450

#SPJ1

7 0
1 year ago
Which of the following is a category of authorization tools
Tpy6a [65]

Answer:

Cloud-Based eLearning Authoring Tools.Locally Hosted eLearning Authoring Tools. Multimedia eLearning Authoring Tools.PowerPoint Ribbon eLearning Authoring Tools.Screen Capturing And Recording eLearning Authoring Tools

Explanation:

Any software, or collection of software components, that authors can use to create or modify web content for use by other people, is an Authoring Tool.

5 0
2 years ago
What cultural characteristics does the Chicano mural movement reflect? Check all that apply.
Nataliya [291]

Answer: i believe it is family, religion, history, music and arts, and folklore.

Explanation:

8 0
3 years ago
Other questions:
  • Need help this will affect my final grade in technology and the dead line has passed!!!
    11·1 answer
  • Unlike artistic drawings, which communicate self-expression and
    15·1 answer
  • Fill in the blank. Do not abbreviate.
    6·1 answer
  • Which of the following is the largest unit of information?
    15·2 answers
  • Bytes are typically represented with a lowercase b and bits with an uppercase B.<br> true or false
    7·1 answer
  • A microsoft windows os component responsible for representing graphical objects and transmitting them to output devices such as
    15·1 answer
  • Solve(-8/3)+7/5 please answer​
    5·1 answer
  • PlZZZZZZZ help will give Brainliest
    8·2 answers
  • Es la actividad que posibilita comunicar gráficamente ideas, hechos y valores procesados y sintetizados en términos de forma y c
    11·1 answer
  • Explain the pros and cons of touchscreen, non-touchscreen, and hybrid devices:
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!