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
Universal Containers requires that all users add at least one Product Option from the Maintenance Feature to a bundle.
zmey [24]

Answer

Set the Max Options for “Maintenance” to be one. Set the Min Options to one & Max Options to two for “Support”.

Explanation:

the Admin set up these requirements for the user using Set the Max Options for “Maintenance” to be one. Set the Min Options to one & Max Options to two for “Support”. Since users must select at least one and no more than two Product Options from the Support Feature and Product Option from the Maintenance Feature to a bundle.

6 0
3 years ago
1.What is the output of the following program? [10 Marks]namespace ConsoleApp1{class Program{static void Main(string[] args){int
Nataliya [291]

The program outputs the following rectangular array:

0 0 0 0

0 1  2 3

0 2 4 6

0 3 6 9

0 4 8 12

This is the correctly formatted C# program:

namespace ConsoleApp1{

   class Program

   {

       static void Main(string[] args)

       {

           int i, j;    // <em>declare index variables used to iterate over the array A</em>

           int [,] A = new int[5,5];   // <em>create a 5 by 5 array</em>

           

           /*<em> Iterate over the array with the index variables i and j</em>

<em>                and initialize each location A[i, j] with the product </em>

<em>                of i and j.</em> */  

           for (i = 0; i < 5; ++i)

           {

               for (j = 0; j < 4; ++j)

               {

                   A[i, j] = i*j;

               }

           }

           

           /* <em>Iterate over the array again. This time, swap locations </em>

<em>                A[i, j] with A[j, i]</em> */

           for (i = 0; i < 5; ++i)

           {

               for (j = 0; j < 4; ++j)

               {

                   if (i < 5)

                   {

                       A[j, i] = A[i, j];

                   }

                   else

                       break;

                   

                   // <em>display the current location A[i, j]</em>

                   Console.Write(A[i, j] + " ");

                   

               }

               /* <em>print a newline to prepare for the next line of printing</em>

                   <em>which corresponds to the next column i</em> */

               Console.WriteLine();

                // <em>pause and wait for user keypress before continuing</em>

               Console.ReadLine();

               

               }

           }

       }

   }

When executed, this program simply prints a rectangular array like so;

0 0 0 0

0 1  2 3

0 2 4 6

0 3 6 9

0 4 8 12

Learn more about predicting program output here: brainly.com/question/20259194

6 0
2 years ago
What type of purchase requisition is used to turn-in a recoverable/reparable material to the ssa?
m_a_m_a [10]

ZRX is the purchase requisition document type used to turn a recoverable repairable material for Remote customers to the SSA.

What is a purchase requisition?

Employees can start a purchase by sending internal documents called buy requisitions. A buy order is issued to a supplier to place the order for the goods/services in question once the purchase has received the relevant person or department's approval.

What is the purpose of a purchase requisition?

A purchase request form is a formal internal document that is utilized during the purchasing process. Employees utilize this to communicate the resources they require to department supervisors. Therefore, an employee will submit a formal request via a requisition form to the purchasing department if they have a requirement.

Learn more about purchase requisition: brainly.com/question/16413109

#SPJ4

5 0
2 years ago
Need help fast this is do a 4
Stells [14]

Answer:

I believe the answer is B.

8 0
2 years ago
The name of a Variable effects its value<br><br> True<br><br> False
Y_Kistochka [10]

Answer:

option A ) true is right answer.

7 0
3 years ago
Other questions:
  • Which is not an example of a boolean operator?
    6·2 answers
  • "what are the problems with tcp over wireless network?"
    15·1 answer
  • Write a Java program that prompts the user to enter a sequence of non-negative numbers (0 or more), storing them in an ArrayList
    5·1 answer
  • Which industry has the highest employment figure for both teen and young adults in July, 2014?
    6·1 answer
  • You are tasked with accumulating survey data on a web page and are responsible for it being free from dirty data once you close
    11·1 answer
  • Write a program that passes an unspecified number of integers from command line and displays their total.
    5·1 answer
  • Write a function called no_you_pick. no_you_pick should have two parameters. The first parameter is a dictionary where the keys
    5·1 answer
  • Select the correct technical term for each definition by using the drop-down menus.
    13·1 answer
  • Write a function named swapFrontBack that takes as input a vector of integers. The function should swap the first element in the
    9·1 answer
  • By the mid-1990s, how did revenue generated from video games compare to revenue generated from movies?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!