Giter VIP home page Giter VIP logo

hwzero's Introduction

hw0, Minutes of Action. Due: Thursday September 8th at 10:00 p.m.

Update: Example of "Tokenize" to 'break' a string into pieces using one or more separators (also known as 'delimiters', such as space character, and comma)

You will create a C++ program that will count the total of minutes, hours, and days mentioned inside of a plain-text file.

Input

The input is a plain-text file, where each line is terminated with an end-of-line character. Each line will have words or numbers. To simplify we will assume that there will not be words containing numbers such as the word: car4sale. (Or numbers containg letters such as 22E01). A word is a string of letters (upper and lower case). Lines in the input file that start with the symbol # should be considered comments and therefore skipped.

Example 1:

A person of interest travels 20 minutes each day.
Meredith travels 1 hour by train to visit Derek. However, Derek can visit her in one minute
#this line is a comment because it starts with #
#for example, this comment line contains 1000 minutes but they do not get added anywhere
Cristina does 4 minutes of yoga on her lunch break; she's done that in the last 3 weeks. 
She can drink 3 minutemaid bottles a day.

Each line that is not a comment will be processed to find references of minutes, hours, or days. Such items will be appear first as a number and then one of these words: minute, minutes, hour, hours, day, days. There may be empty lines in the input file. The words and numbers may be separated by spaces, commas, parenthesis, semicolon. Words and numbers will be separated by at least one non-letter or non-digit symbol. A word is one or more consecutive letters until a non-letter is next. You can assume that a word will be at most 30 characters long (always letters). Numbers are always digits (0,1,2,...,9). Numbers will have maximum of 10 digits. There may be things that look like a number but are not, such as: 1024K.

Program specification

The main program should be called uhday and the syntax in which it will be tested is as follows:

uhday "input=FILENAME"

The parameter input specifies the name of the input file.

Example of program calls:

uhday "input=gray.txt"

or, ./uhday "input=gray.txt"

The source code will be compiled as follows:

g++ -std=c++11 -o uhday -I ./ *.cpp

Output

Your program will output to the console (such as via cout, or printf) with the results of counting, independently, the minutes, hours, and days metioned in the file. Your program must follow the output format exactly to facilitate automated grading (and to avoid failing test cases due to things such as output of an empty line at the end).

Output for the input example.

Minutes:24
Hours:1
Days:0

Assumptions

  • The input file can fit in main memory (not larger than 10kb).

  • The words "Minutes", "Hours", "Days" in the output will be exactly like that. They are expected to always be in plural.

  • You can assume that it is safe to treat each line independently. There will not be test cases such as line 1 ending in a number, and line 2 starting with: day.

  • Examples of valid numbers due to the character next to them being a separator:

    (20 minutes)

    They were sleepy;5 hours later they woke up.

  • Examples of numbers that are not valid, that is, your code is not expected to count them.

    The student reads 40K minutes every day.

    It took 12.67 minutes to form an opinion.

  • The obvious separator is space character. You can assume that these are the separators that you must consider: space, comma, semicolon, left parenthesis, and right parenthesis. That is, any of the last 4 separators beforementioned is basically equivalent to a space character. In the example shown above, 12.67 is simply a number that is not valid (numbers are all digits).

Requirements

  • This assignment is pass/fail. If your program scores more than 60 points, then you will pass.
  • Place your codes in a folder named: hw0 (Failure to do so will cause your program to have a zero grade due to inability for doing automated grading).
  • Your program should not produce any unexpected output when it is doing intermediate calculations because doing so will interfere with automated grading and some test cases will fail.
  • You can not assume a maximum number of lines in the input file.
  • You can assume a maximum number of 99 words per line.

hwzero's People

Contributors

akshay199456 avatar aleman avatar c3m20 avatar dfatimazohra avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hwzero's Issues

Question about Output for hwZero

I am confused about the output requested for the homework assignment. In the section "Output", the second sentence states

" The first column is the time, the second is the name of the person, the third is the duration, and the fourth is the status. ".

Does anyone know what that sentence is asking for and could you provide a simple example.
Thank you,
Alex

What is a number?

"You will create a C++ program that will count the total of minutes, hours, and days mentioned inside of a plain-text file."
...
"However, Derek can visit her in one minute."

Will valid numbers (of minutes, hours, days) be represented in letters (a,b,c), digits (1,2,3) or both (tokens of letters or of digits)? (Valid referring to numbers we must count, invalid referring to numbers we must skip.) In the "Input" section, you define what a word is, but you only state that numbers will have a maximum of 10 digits. Are we to assume that numbers are strings of ascii digits?

Also, where exactly do we sign in with our Linux accounts? I've looked around on your website, but can't really find any solid mention of it. If you had mentioned it in lecture, I've all but forgotten what you said by now. Will you be committing more information later?

Thanks!
Eric

"Numbers will have maximum of 10 digits."

The largest integer that can be stored is 4,294,967,295 on a 32 bit machine that doesn't support 64 bit addition (I would assume). Will we have to consider numbers larger than this, and/or is the server machine 64 bit? (It would take more effort to do.)

"The words and numbers may be separated by spaces, commas, period, new-line character, parenthesis, etc." Can we assume that each valid number and its category (m, h, d) will be separated by a space and only 1 space? If the separation can be more than 1 whitespace, then it would take considerably more effort to distinguish between certain situations such as "...since then, 100.days have passed..." and "...she went from 0 to 100. Days have passed since then." This particular situation would require that "minute, minutes, hour, hours, day, days" can start with capitol letters, but others might not.

Program is not working correctly on Linux server.

My code works perfectly fine on my laptop for all three test cases and also the example from the instruction, but when I uploaded onto the server, it would not run correctly. One function would not work correctly occasionally. I use visual studio 2015.
What might causes this problem?

String data type numbers

In the input example, near the end of the second line, there is a piece or relevant data "one minute". Will our code have to search for data types to add together that are a String? That seems like it may complicate things a bit more than I was expecting.

Notifications

Ok. I'm new to git, but most of it is pretty self-explanatory. I watched the repo to get notifications of the commits. However, it appears we get notifications of literally everything whether or not we want them. I have been able to find the "unsubscribe" button for a few different pages here and there. But somehow, more notifications that are not commits still seem to pop up. The notification system seems to be lacking some obvious features. So, may I propose that emails be sent out every other day with information on the commits? I think we all need to know when the homework randomly changes from day to day. But
(and this may just be me) I don't think anyone cares about random comments/issues/pull requests that do not concern #1 the homework assignment, and #2 our grades. Since there isn't an easy way to set up notifications, please consider an email route.

Also, why do I receive every email from Akshay to you? Is there a way to stop receiving them? I'm really confused on how this notification thing works.

Thanks

Input data

I would like to have clarification on the input and the way it should be processed.

  1. If the line says "They left at 12.5 minutes later, they came back." with 2 sentences being separated by just a period and not a space, would that 5 be added to variable minute(s)? Or can we assume there would be no such cases.
  2. If, for example, "24 minutes" is written into two lines, such as
    They left 24
    minutes ago.
    Would 24 be added to variable minute(s)? Or can we also assume there would be no such cases.

help on "input=FILENAME.txt"

screen shot 2016-09-08 at 3 16 33 pm

I have the problem with parameter input , can anyone show me how to do it ? , i did follow the one post on on here by professor but received an error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.