homework assignment 27

Do you require help with your paper? Use our custom writing service to achieve better grades and meet your deadlines. Trust our team of writing experts with your work today, and enjoy peace of mind.


Order a Similar Paper Order a Different Paper

There are three parts to the Homework.

please keep it simple. No need for //comments. just the code is fine.

Please submit each part in its own .java file.

  • B01 Playlist Part I (25 points): Create and upload a java file called PlaylistPartI.java.
  • B02 Playlist Part II (25 points): Create and upload a java file called PlaylistPartII.java.
  • B03 Counting Votes (25 points): Create and upload a java file called Votes.java.

B01 – Playlist I

Context: You will write a program that manages a playlist. In this program, the user will add songs to the playlist.

Important: Your playlist will only allow 10 and only 10 songs. You can assume the playlist will not have less than 10, or more than 10 songs. Don’t use an ArrayList for this exercise.

Your playlist will consist of a collection of titles of songs and that’s it. It will not contain the duration or anything other than the title of the song.

You need to:

1. Create a method to ask the user for the title of the different songs to add to the playlist, and add those titles to your array until the playlist is full. Your method must return the full playlist.

2. Once your program has asked the user to fill the playlist, from your main method you will iterate the playlist and print the title of the songs in the order they were added.

Use JOptionPane dialogs to display messages and ask for the user input.


B02 – Playlist II

Context: You will write a program that manages the playlist created in the previous exercise. In this program, the user will be able to listen to that playlist and perform actions such as move to the next song, or move back to the previous song.

You need to:

1. Once your program has asked the user to fill the playlist, from your main method you will call a new method play.

2. This method play will:

2.1. Display a dialog with the following message: “Now playing <title of the first song in the playlist>

2.2. Display a dialog with an option menu like the following:

The following actions are supported. Enter the code:

A: Repeat current song

B: Move to the next song

C: Move to the previous song

D: Exit

If the user enters A, then your program will go back to step 3.1 but with the current song.

If the user enters B, then your program will move to the next song in the playlist and go back to step 3.1, but with the new current song.

If the user enters C, then your program will move back to the pervious song in the playlist, and go back to step 3.1 but with the new current song.

If the user enters D, then your program will finish.

NOTE: If the user moves past the last song, then the new current song will be the first one. That is, if the user tries to move to the 11th song, but there are only 10 songs, then the playlist will go back to the first song in the playlist.

Similarly, if the user tries to move back from the first song, then the playlist will move to the last song in the playlist. That is, if the playlist is playing the first song, and the user moves back, it will move back to the last song in the playlist.

Use JOptionPane dialogs to display messages and ask for the user input.

Context: You will write a program that will allow users to enter electoral votes between two candidates A and B. Then, it will automatically count how many votes each candidate received and display a summary with the results.

Important: In this case, first you will ask how many people will vote. For each vote, the name of the candidate will be added to the collection.

Your program needs to do the following:

1. Have a method that first asks how many users will vote and then, it will display the following menu and ask the users to enter the candidate they are voting for.

Voting system. Please, enter:

A – To vote for candidate A.

B – To vote for candidate B.

Z – To finish the voting process.

Anything else will be considered as an INVALID vote.

As new votes are entered, your program needs to add the appropriate value to the collection (either the name of the candidate, or “INVALID” for invalid votes). When Z is entered, your program will stop asking for votes and will return the collection of votes added so far.

2. With the list of votes, your program will call another method that will count how many votes each candidate received, and how many invalid votes were entered in the system. Then, it will display a dialog with the following format:

Results:

A received X votes (<percentage of votes for A>%).

B received Y votes. (<percentage of votes for B>%)

Z votes were invalid. (<percentage of invalid votes>%)

Total: M votes were entered in the system.

Important: You need to use JOptionPane dialogs to display messages and ask for inputs.

Writerbay.net

Do you need help with this or a different assignment? We offer CONFIDENTIAL, ORIGINAL (Turnitin/LopesWrite/SafeAssign checks), and PRIVATE services using latest (within 5 years) peer-reviewed journal articles. Kindly click on ORDER NOW to receive an A++ paper from our masters- and PhD writers.

Get a 15% discount on your order using the following coupon code SAVE15


Order a Similar Paper Order a Different Paper