-1

Just started a programming class a few months ago, and I'm going over some review questions for a test. I'm not sure how to tackle this one. We have to format a few lines of text.

So something that looks like this: 2002/Bourne Identity/Action/1:58

Will have to look like this: 2002 - Bourne Identity Action 118 minutes

There are a few of these, and then we have to add up the total running time for each genre. Would I be right in using the split function here?

Thanks

2
  • stackoverflow.com/questions/950409/… Commented Apr 18, 2016 at 23:13
  • Split the string on / and use the new String array to do the conversion accordingly Commented Apr 18, 2016 at 23:14

1 Answer 1

0

I am assuming that the input data are 4 variables. For example

public String parse(Integer year, String title, String genere, Date duration)

So you just have to operate the values. For example

return year + " - " + title + " " + genere + " " + toMinutes(duration) + " minutes"

where toMinutes(duration) is a function which parse a date to minutes.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.