How to count a song played in a day?

Okay so I am asked to create a jukebox project for my school. And the specification for that is, each user can only play two songs per day. I am really confused on how to deal with this, so far I am thinking of using the GregorianCalendar, but just confused on how to do this. Any suggestions?
the code so far:
import java.util.Date;
import java.util.GregorianCalendar;
public class JukeboxAccount {
     private int id;
     private int songPlayed;
     private String username;
     public JukeboxAccount(String name , int identification){
          id = identification;
          username = name;
     public int getID(){
          return id;
     public boolean songsPlayedPerDay(){
          GregorianCalendar today = new GregorianCalendar();
          today.setTimeInMillis(10000000);
          if (songPlayed < 2){
               songPlayed++;
               return true;
          else
               return false;
}I know the code above for the songsPlayed is still messy, that's why I need some suggestions.

well I think I found my self a good solution and it is just as SUSHANT_J said, I should keep track when the song is played and check with the current date.
Now after this I need to compare with when the song is played and with the current date. How do I get the currentdate? If I just say:
GregorianCalendar current = new GregorianCalendar();
the problem here is to get the currentDate and the date when the song played, how do I get this??

Similar Messages

  • HT1689 How do I make songs play automatically in sequence on iPad?

    How do I make songs play automatically on iPad?

    Other than starting play from the songs list - As far as I know, unless you create a playlist for all of the music that you want to play without stopping, there is no way to play songs continuously in the Music App on the iPad.
    If you start play with a song in the songs list, then I believe all of the songs will play one after the other. If you mean though, starting with one album or artist and then moving on the the next album or artist, you have to create a playlist for that.

  • Itunes 11-Turn off play next or how to make a song play now?

    itunes 11-turn off play next or how do you make a song play NOW

    Moderator's Note:
    Nokia Support Discussions is a peer-to-peer troubleshooting and support forum. If you wish to make your feelings known to Nokia directly, we recommend you to contact us via your local Nokia Care line.
    PM to user: 
    We would like to inform you that if you want to provide any feedback directly to Nokia, we suggest that you use the 'Contact us' link at the top of the page or contact your local Nokia Care line.

  • How do I stop songs playing twice?

    Why are my songs playing twice?

    I answered my own question just by fooling around. Play a song. When the album artwork appears (sometimes must tap "Now Playing" to get it). There are two double arrow icons under the playing time. The arrows to left are perpendicular to each other. If they are orange, songs will replay. Tap this arrow. When it turns white, replays will stop. I haven't really figured out what the criss-crossed arrows icon on the right is for yet. One person said this is covered in the manual but I'll be darned if I can find it anywhere.

  • How do I delete songs from 2013 "12 days of gifts"?

    I downloaded Avicii's 2 songs from the "12 days of gifts" promo of 2013 onto my iPhone 4s. How do I remove them? I can remove other songs, but can't swipe to delete. Also, there's the iCloud logo next to them. Very frustrating in trying to find help online with this question.

    If there is a cloud icon next to a song, then that song file is not physically present on the device - cloud icon just means it is available for download. Go to Settings>Itunes and App Store>Show all and Turm Music OFF - songs will disappear from Music App.

  • Need help, how to keep some songs playing together

    I've done a lot of searching for an answer to this but can't seem to find one and I'm not sure this is possible, but let me ask anyway.
    I have a number of playlists in which I shuffle the tunes but would like to have certain songs (for example Queen's "We Will Rock You" and "We Are The Champions" play in the correct order (i.e., back to back) as they are intended.
    Is there a way to sort of "combine" or group these two songs so that even during a random playing in a playlist they will still play together?

    Actually, if you have the CD, the easiest way to do this in in iTunes. You won't need to use iMovie.
    Before you import the songs from the CD, select (highlight) the songs that you want to combine together, go to the 'Advanced' menu and select "Join CD Tracks". This will combine the songs together when they are imported into your Library.
    Hope this helps!

  • Downloaded an E.P. and all of the songs play fine except one which skips itself. The play count goes up and if I click later in the song it will play, but it doesn't play automatically, how do i fix this?

    Downloaded an E.P. and all of the songs play fine except one which skips itself. The play count goes up and if I click later in the song it will play, but it doesn't play automatically, how do i fix this?

    many thanks.
    I'd report the problem to the iTunes Store.
    Log in to the Store. Click on "Account" in your Quick Links. When you're in your Account information screen, go down to Purchase History and click "See all".
    Find the item that is not playing properly. If you can't see "Report a Problem" next to the entry, click the "Report a problem" button. Now click the "Report a Problem" link next to the item.
    (Not entirely sure what happens after you click that link, but fingers crossed it should be relatively straightforward.)

  • How to not have songs duplicates in app remote? I have playlists for my iphone and playlists for my pc. All songs of my iphone are also on my mac. When i use the remote app, it plays everything in double.

    Dear all,
    I am using itunes to control all my music and i like to use my iphone, or my ipad to control my music with the remote app.
    But i have a problem: all the music i have in my iphone count as double play.
    To explain everything since the beginning, i personally don't like and don't trust at all the music sync capability of itunes.
    So i have my music on my pc, and i load every type of music as a single playlist (ex a Pop-Rock folder, with all artists folders and so on, makes me a Pop-Rock playlist).
    For my iphone, i created a iphone music folder, with the same classification.
    It means that i don't have all my Pop-Rock music, only a selection. But of course the selected music appears also in my complete music collection.
    So in itunes i created a folder playlist named iphone music, with inside one playlist by type of music (exemple : Pop-Rock, which contains some files of my main Pop-Rock collection).
    So i do have duplicates in my hard drive. But when i selected the playlists to be shared on home sharing in itunes, i selected only the main playlists, not my iphone playlists! But still, when i look for ACDC artist for example, i should see only what i have on my pc, not what i have also on my iphone.
    The result is if i play an album for example Back In Black (i have it full on my hard drive, and full on my iphone too), then every song is displayed in remote app in double, and also played in double:
    Here is how it is displayed:
    Song 1
    Song 1
    Song 2
    Song 2
    So the remote app plays Song 1 one time, then Song 1 (the second Song 1) one time and continues like this to Song 2 etc...
    I guess that if i put my selection of songs on my ipad, i will then have everything in triple....
    It is very annoying. Is there a way for me to change that? Or for an update to be made (based on ID3 Tag) to not play everything twice or more? It would have an ID3 Tag No Double toggle button.
    I don't want to select from my main music to send elements to my iphone as doing that i lost a lot of music multiple times. This way of doing is not safe at all (at least for me).
    What is possible to do? Is there room for improvement here (i believe so). Is there a way for me to avoir this very annoying effect?
    I would really like to put my music to my iPad2 also, but after i'll have triple play....
    Thank you for your help.

    Nobody knows? Not even administrators?
    Please it would be really nice to have help on that to take all the benefit of the remote app.
    Thank you very much in advance.

  • 1st gen ipod Shuffle not updating play count for songs

    I've noticed since I updated to the iTunes version 7.2.035 that plugging in and updating the library with my iPod shuffle no longer updates the play count for the songs I've listened to. Is there a known fix for this? Anyone else experiencing the same problem with their 1st gen ipod shuffle (512)?

    Well, I have that problem too. My shuffle holds about 125 songs or so, yet I've noticed there are always a good 20 or so songs that won't play, no matter how many times I load them onto the device. I have had that problem since I inherited it from a friend.
    My new problem is that every time I plug my iPod into iTunes, it no longer updates the playcount for songs. In other words, if I load a song that I've heard 3 times, hear it twice during the day, and replug in my iPod at night, it used to update that song's playcount in the library to 5, but now they still read 3. It's also failing to update the "date last played" field.
    I use those to help make sure that I don't load the same songs over and over again by creating a custom playlist that will comb out songs played in the last few days and have a very high play count. Since these are no longer updating, I've noticed that I keep arriving at work only to find my iPod has the same or similar songs as the day before, and dude, if I wanted that, I'd listen to the radio!

  • ITunes account doesn't show the song play count

    My iTunes account stopped displaying my song play count.

    Hey DC71955,
    Great question, it sounds like the "Plays" column is not selected. We simply need to turn it back on.
    In iTunes 11, click the "View" menu and choose "Show View Options". Located under "Stats" is the "Plays" option.
    Apple - Find Out How - Music - iTunes
    http://www.apple.com/findouthow/music/itunes.html#tips-viewoptions
    Thanks,
    Matt M.

  • What is the process to update song plays count ?

    Hi,
    i'm using iTunes Match on 5 devices : 2 windows, iPad, iPhone and MacBook
    Everything is ok, sync is perfect for new songs i add anywhere.
    If i rate a song, it appears rated the same way on all other devices in a fex seconds.
    BUT
    what is the process to update the song plays count ? 
    because it doesn't seem to sync correctly.
    I have updated song plays count by scripts on one iTunes and it doesn't update at all anywhere else. I havez tried to "Update iTunes Match" and it just brought back the old song plays counts.
    How can i update the song plays and make the value change on all devices ?
    Thanks

    Take a look here:
    Purchasing iOS 3.1 Software Update for iPod touch (1st generation)
    Regards.

  • IPod song play count

    How come playing a song on my iPhone doesn't seem to increase the song's play count when I look on iTunes? Is there any way to fix this?

    It should, but you need to listen to the entire song all the way through until the iPod begins playing a new song for this to register.
    As a test, I checked the play count and last played date and time for a song in a playlist in iTunes that I have selected to be transferred to my iPhone. I played the song on my iPhone all the way though until another song began to play.
    I synced my iPhone with iTunes and the play count and the last played data and time was updated.

  • IPod touch - some songs played don't register on iTunes play count

    Hi there!
    I know this might sound a bit anal, but I like keeping a check on how many times I have played my songs...and at the moment the only thing annoying me about the iPod touch is that some songs I have played don't increase their play count on iTunes when I sync...any ideas why this might be? I would appreciate any ideas!
    Thanks a lot!

    So what is the difference between off and sleep, for us Touch noob's?
    Does the top button turn it off or sleep? I know that turns off the screen while playing a song. And standby is when you just press pause and let the screen go off after one minute?
    I tested the above play count thing, and it does only update for me the most recent set played. I love the play count myself...and now I don't have my morning commute sets counted, and the 5 hours straight of jazz I played on Saturday night!
    This seems to be pretty basic stuff to me....it always worked with my shuffle and my nano.

  • How do I add songs to a current playlist now that I've downloaded iOS 7 to my iPhone 4? I don't seem to be able to add songs anymore-- when I try to add the song, it just starts playing it instead.

    I used to be able to open the playlist, choose to Edit it, then go to the song I wanted to add and the song would have a plus sign next to it and if I tapped the song, it would be added to the playlist however many times I tapped it. Now when I Edit the playlist, I go to the song I purchased to add it and there is no plus sign, but I figured, hey maybe that's new too, and I tap it anyway. Instead of going on my playlist it just starts playing. I even thought, after multiple attempts at this, that if I let the song play all the way through it would go on my list, but that was a failed idea as well.
    Does anyone out there know how to fix this? I realize I can probably start a new playlist---or maybe I cant!!! --I haven't even tried! But even if I can, I don't want too because this one has lots of songs in a particular order, and I just want to add my new purchases!
    I already greatly dislike the visual changes that came with iOS 7 - so I hope these other issuesare easily fixable....
    Thanks!

    Hi TakesTwo2Tango,
    Thanks for using Apple Support Communities.  It sounds like you should definitely be seeing a plus sign after tapping Edit, so I would try a couple relatively easy things (closing the Music app, resetting the iPhone):
    iOS: Force an app to close
    http://support.apple.com/kb/ht5137
    iPhone, iPad, iPod touch: Turning off and on (restarting) and resetting
    http://support.apple.com/kb/HT1430
    Cheers,
    - Ari

  • I would like to know how can I set songs in iTunes to play at different times automatically during the day. i.e. one song at 10am the other at 10:30am etc..

    I would like to know how can I set songs in iTunes to play at different times automatically during the day. i.e. one song at 10am the other at 10:30am etc..

Maybe you are looking for

  • Problem showing the crystal report viewer in form after added the component on it

    Greetings I have a problem running a program. I created a form which I added the component Crystal Report Viewer perfecty but during program execution when I call that form my VS 2012 Ultimate show the following error: Translated: Failed to create th

  • Screen compression problems in sales order additional data b screens

    When i enter va01 for the slaes order he screens are: SAPMV45A8309, Sales Document Header - User Exit Header SAPMV45A8459, Sales doc. Item - User exit item Use screen painter to change them. (transaction SE51) what happened is that i have four boxes

  • Is firmware update (G4 Sawtooth audio fix) mandatory for upgrading to OSX?

    Ive heard that you have to use the old Mac OS 9.1 to update the G4's firmware before installing OSX tiger. My problem is that ive bought a G4 without any existing operating systems and only have OSX tiger to put on it. I think the firmware is just an

  • Excel file upload restriction

    Dear, I have developed a object which upload any type of file( mainly excel file ) form desktop. Now i want to restrict user to upload the excel file , if that file is open in desktop. Please give me idea how i ll solve this issue ?????? Thanks & Reg

  • Organizational Data Determination

    Hello! I have a transaction type with a organization data profile using rule 10000144. When I create a document, the system doesn´t determine sales organization and distribution channel, but determines the organizational Unit correctly. The BP used w